|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? Can this only be done using cookies? Might there be other alternatives such as php3 or javascript? Thank You for your time. If you need more info please email me or post the message here. Raymond |
|
#2
|
|||
|
|||
|
Make a real simple perl script, and post the information to the script. Place the HTML for the second page in the script and display said information with a variable.
Here is the code that you would need to do that. Post variable1 and variable2, then place $varable1 and $variable2 in the html for the second page: #!/usr/bin/perl print "Content-type: text/htmlnn"; &form_parse; $variable1=$form('variable1'); $variable2=$form('variable2'); print <<endhtml #put html in here endhtml sub form_parse { read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; }} |
|
#3
|
|||
|
|||
|
Well you can create an invisible frame where all your script resides and stores the values of the form elements. What I mean by invisible frame is:
<frameset rows="0,*"> <frame src="invisiblepage.html" name="invisible"> <frame src="formapage.html" name="formpage"> </frameset> Each time the user goes to a new page with a different form the values of the previous form will be stored in the invisible page which doesn't change. Spookster |
|
#4
|
|||
|
|||
|
I've had success doing the same type of stuff using hidden fields and the perl module CGI.pm.
let me know if you still need help on this one and I'll pass along some code. |
|
#5
|
|||
|
|||
|
Well I've tried Mr. 12338323 method but it somehow it gives me this error
HTTP 500 Internal Server error and it won't let me display the HTML code. I have some javascript in the code I wonder if that's it? Well right now I got the same thing done using perl and php3. Essentially the same thing Mr. 12338323 is doing but instead of putting the HTML in the perl code itself, I parse the variables out to a php3 file which is the HTML page itself. The only thing wrong with that is that is shows the variables in the URL. Is this an unsecure method? I haven't tried using hidden frames. I'll try it out and let you know. Well any help is appreciated so post away Mr. bag Here's the code I'm using #! /usr/local/bin/perl use CGI; $query = new CGI; $query->import_names('R'); $R::File =~ s/ /+/g; if ($R::File) { print $query->redirect("http://www.mydomain.net/pageone.php3?File=$R::File"); } else { print $query->redirect("http://www.mydomain.net/pagetwo.html"); } [This message has been edited by kong (edited 12-22-99).] |
|
#6
|
|||
|
|||
|
ok here is the basic idea.
#!/usr/local/bin/perl use CGI; $input=new CGI; $firstName=$input->param('first_name'); $lastName=$input->param('last_name'); # the above parses the form entry from the #name input page. print "<FORM ACTION="/cgi-local/nextStep.cgi" METHOD=POST>n"; print "<INPUT TYPE=hidden NAME="first_name" VALUE=$firstName>n"; print "<INPUT TYPE=hidden NAME="last_name" VALUE=$lastName>n"; print "</FORM>n"; #this next part takes the values that you parsed in the first section and puts them into hidden fields which the user cannot see but get passed back to the server when they hit the submit button. The in the nextStep.cgi code, you parse the hidden fields using $firstName=$input->param('first_name'); $lastName=$input->param('last_name'); just like you did in the first section. using this method, you can pass information from one form to the next. Its pretty raw but it works. hope it helps. |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Passing information between forms |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|