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.
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.
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.
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.