SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Miami, FL
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick PHP form help

    Hi everyone.

    I'm not much of a web programmer, per se, but I understand programming concepts.

    I built a quick submission form that takes the input from about 8 fields or so, which include text boxes, text areas, and radio buttons. When you submit, it sends an e-mail to a specified address as well as the user who submitted the form.

    I've got that working just fine, and I added in a quick JS validator too, so that's not the issue.

    The problem is, I'd like to split the submission form into two pages. For instance:

    User fills out a form with a number of questions.

    User clicks "continue", and once it passes validation it moves onto another page.

    In this page, the user enters his name and contact info (about 10 fields.) Once the user clicks "submit", I'll validate that form as well and if it all checks out, I would like to submit the form with the contact info and the contents of the previous page.

    You can probably guess me error already. Once you fill out the first page and continue, you enter the contact info then send. What you get is an e-mail that only contains the contents you filled out in the second page, not the first. I need to know how to "keep" the information from the first page when you move on to the second. Does this make sense?

    It's happening because the first page I use this for the first form:
    Code HTML4Strict:
    <form name="form1" id="form1" method="post" onsubmit="return validate()" action="page2.html">
    Code HTML4Strict:
    <form name="form1" id="form1" method="post" onsubmit="return validate()" action="submitform.php">

    Maybe the error is there? Meh.

    I'm sure it's a pretty easy thing to do, and maybe I'm just overlooking something trivial. If anyone can help I would much appreciate it.

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all you change first form's action as page2.php not .html so that you can get the submitted field values from first form to second. After all you can have the values posted from first page form with $_POST as normally you have done while sending the email. And store those values in some HTML hidden form elements and now you can get those values in the third page i mean the page where you post your second form data.

    Do you understand what i mean?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Miami, FL
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you're saying in order for me to be able to transfer the values from the first page to the second, the second page needs to be a PHP page?

    Thinking about it, that makes sense. But what do you mean by storing the values in a hidden form element?

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    without storing the values from first form into the second form, how can you get those values in the email sending page? so either you can use session variables to store the values of first form and you can have those values in main action email sending page.

    does that make sense now?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Miami, FL
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what I was looking for; sessions! Thanks a lot, mate.

    Right before I read your message, I did it by using hidden form elements like you said.


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
  •