1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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.

  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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:

    print "Content-type: text/htmlnn";

    print <<endhtml

    #put html in here


    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;
  4. #3
  5. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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">

    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.

  6. #4
  7. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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.
  8. #5
  9. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    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;

    $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).]
  10. #6
  11. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    ok here is the basic idea.


    use CGI;
    $input=new CGI;

    # 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


    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.

Similar Threads

  1. Forms information
    By deathsythe in forum PHP Development
    Replies: 1
    Last Post: December 27th, 2003, 02:16 AM
  2. Passing Input Between Forms
    By haigler in forum PHP Development
    Replies: 11
    Last Post: March 28th, 2001, 08:02 AM
  3. Replies: 1
    Last Post: January 28th, 2000, 04:32 AM
  4. Replies: 4
    Last Post: January 21st, 2000, 11:57 AM
  5. Passing information between forms with php3?
    By kong in forum PHP Development
    Replies: 5
    Last Post: December 15th, 1999, 09:54 AM

IMN logo majestic logo threadwatch logo seochat tools logo