Results 1 to 4 of 4

Thread: How to Pass data from one page to another in PHP?

  1. #1
    Join Date
    Dec 2008
    Posts
    112

    How to Pass data from one page to another in PHP?

    I am trying to pass the variables in a form from one page to another. Could someone take the time to walk me through this? I do not know anything about PHP. This works fine in that the company name appears in the URL... but when I try it displayed as very long URL variables as well as broken link.

  2. #2
    Join Date
    Dec 2008
    Posts
    120

    Re: How to Pass data from one page to another in PHP?

    Passing the variables from a form to another page depends on the method of your form...for the purposes of this explanation, I will assume your form has an method of POST.

    Code:
    ^a href="http://yourdomain.com/test2.php?first_name=^?php echo $first_name?*&last_name=^?php echo $last_name?*"*Test Page 2^/a*
    
    I can also pass variables in the "action" attribute of the form.
    This method of passing values in php only works if the user clicks on the links that I have structured.

  3. #3
    Join Date
    Mar 2008
    Posts
    232

    Re: How to Pass data from one page to another in PHP?

    It should be noted that you are supplying the same URL as the action for both forms...did you not specify that you will be sending the information through different pages? I don't recommend ever using GET variables to save session state as URL's are easily modified. Either use sessions with PHP (real simple) and populate the javascript variables on page load, or even better, just use Javascript cookies. This method of passing values in php only works if the user clicks on the links that I have structured. This proves handy when I only want the user to choose a certain link, or when I want the variable I passed to only be available to the script that the link targets.

  4. #4
    Join Date
    Nov 2008
    Posts
    43

    Re: How to Pass data from one page to another in PHP?

    I'm not very good at XML, but another option you may have, is to send all the data to a XML file, and store the information in it through all the 4 pages, and when you are done, parse it to add the info to your database. The $_GET method should not be used for security sensitive stuff unless other mesures to encrypt and secure the data have been taken. Don't ask me for code for I still have to learn a lot of XML.

Similar Threads

  1. Replies: 9
    Last Post: 30-08-2010, 04:57 PM
  2. How to Pass Data Between Two MDI Forms
    By Brunoz in forum Windows Software
    Replies: 3
    Last Post: 25-09-2009, 11:19 AM
  3. How to pass MVC data from attribute to controller
    By Saaarc in forum Software Development
    Replies: 3
    Last Post: 14-07-2009, 10:14 AM
  4. Replies: 4
    Last Post: 25-02-2009, 07:15 PM
  5. how to pass the dataset from one page to another page in Asp.Net
    By kaartik in forum Software Development
    Replies: 3
    Last Post: 27-12-2008, 05:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,224,496.22251 seconds with 17 queries