December 14th, 1999, 10:27 AM
Hello I would like to know whether it is possible to pass information between forms i.e. a persons name and company name.
This is what I would like to do.
I have a form which takes in a persons name and company name. Then that person proceeds to download files from my server on a different form. When that person downloads these files, I have a script that stores the name of the downloaded file. My problem is how do I also store the person's name with that file since the download page is on a different page?
In a nutshell, how do I pass the information from one form to another and keep the users information consistent i.e. possibly store the info in a variable on the users computer?
I know that this can be done using cookies but can php3 do this also?
Thank You for your time. If you need more info please email me or post the message here.
December 14th, 1999, 06:04 PM
Of course, PHP can easily pass variables from one page to another.
In fact, your first page doesn't even need to be a PHP page, just a standard form which submits the form variables to the receiving PHP page:
<form METHOD="POST" ACTION="yourpage.php3" NAME="yourform">
<input type="text" name="firstname">
<input type="submit" name="Submit" value="Click Here to send this form">
Thus "firstpage.html" would send the variable for "firstname" to yourpage.php3, where it could be read as $firstname.
You could then from there make a secondary form going to yet another PHP page, and so on, if you wanted to.
December 15th, 1999, 08:29 AM
Thanks for the reply. I know that you can use PHP to process the values but I need the values to carry over to the next page.
Here's how I have it set up right now. I have a form that submits these variables
Name,Email,Subscribe to a perl script which does the following.
Here is part of the HTML code i have in test.php3.
<INPUT TYPE="hidden" NAME="Name" VALUE="<?php echo $Name ?>">
<INPUT TYPE="hidden" NAME="EMail" VALUE="<?php echo $EMail ?>">
<INPUT TYPE="hidden" NAME="Subscribe" VALUE="<?php echo $Subscribe ?>">
but it seems to store everything into Name. How do I pass it into their respective fields? I think that I might be using the echo function incorrectly to cut up the variables.
Any help is appreciated. Thank You
December 15th, 1999, 08:53 AM
When you do it the way rycamor described (form with METHOD=POST), you can actually use the submitted variables on the next page as values in the next form (the values are stored in $Name, $Email, $Subscribe). Just try it out.
The other question about the Perl-syntax: on the url, multiple variables are concatenated with a "&", like: page.php3?var1=value&var2=value
December 15th, 1999, 09:05 AM
Aaaah. It was the perl syntax that was wrong.
It works fine now except that the variables show up in the url like so
Is this in anyway a dangerous situation that I should worry about the variables showing up? Is there a fix?
Thanks for all your help people.
December 15th, 1999, 09:54 AM
I don't know what security level you want, but if you parse the variables through the form with METHOD=POST (without submitting through Perl and URL), at least the variables won't show up in the URL.