SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard johntabita's Avatar
    Join Date
    Mar 2001
    Location
    In a big, big house, with lotsa lotsa room
    Posts
    1,062
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Pass form values to a second page?

    Hi,

    I have a formmail perl script that I've used successfully a number of times. However, I'm now going to split the form over 2 separate pages.

    On the first page, the button will be a "Next" button rather than a Submit button. How do I pass the values from the first page onto the second page of the form so that ALL of the form values are processed by the perl script?

    Thanks!

  2. #2
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hm...

    I don't know Perl, but if I was in PHP it would be simple to get the script to output something like this:
    <form action="part2">
    <input type=hidden name="var1" value="valueofvar1">
    <input type=hidden name="var2" value="valueofvar2">
    <input type=hidden name="var3" value="valueofvar3">
    <!-- rest of the form -->
    </form>

    Is that what you're looking for?

  3. #3
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could your "Next" button launch a Javascript which will submit the form.

    You do it like this.

    Code:
    <input value="Next" type="button" onClick="document.myForm.submit();">
    Change "myForm" to the name of your form of course.

    I really don't know Perl scripting, but the rest should be easy from there. You should do what delemtri mentioned and use the values submitted from the first part of the form as hidden inputs in the second.

  4. #4
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you would do is submit the form as per normal. But direct the user to the second page with say...a variable.

    like: <input type="hidden" name="pg" value="2">

    On the second page, you would grab all the input from the previous page into <input type="hidden"....> fields.

    I'm sure you know how to grab the variables and parse them into variables?

    Like..

    use CGI::Carp qw(fatalsToBrowser);
    use CGI qwstandard);

    $query = new CGI;
    @params = $query->param;
    foreach $param(@params) {
    $theparam = $query->param($param);
    ${$param} = $theparam;
    }
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  5. #5
    SitePoint Wizard johntabita's Avatar
    Join Date
    Mar 2001
    Location
    In a big, big house, with lotsa lotsa room
    Posts
    1,062
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    I'm sure you know how to grab the variables and parse them into variables?
    Umm... no.

    I'm not a perl programmer, but if you give me the details, I think I could figure it out.

    Thanks!

  6. #6
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh..Use the script that I gave you. Its the most efficient routine I have to date.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein


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
  •