Jump to content

multiple forms


NickG21

Recommended Posts

hey everyone,
      i am working on a signup page that uses 6 different forms.  in each page i use
<?php
  session_start();
  foreach($_POST as $key => $var) {
    $_SESSION[$key] = $var;
  }
?>
to store all the information that is submitted.  after the 6th and final form page is submitted i send the information to a formmail.php in order to e-mail all of the information to my e-mail address, however, the only thing submitted is the value of the last thing that was checked in the last form.  The thing i don't understand is that when i do an

echo '<pre>', print_r($_SESSION, true), '</pre>';

all of the information from all six forms is displayed on the last page but will not send in the mail.  can anyone help me out a little bit, all help is greatly appreciated
thanks a lot
Link to comment
https://forums.phpfreaks.com/topic/32873-multiple-forms/
Share on other sites

If this "formmail.php" is one of the standard ones floating around, it only knows about information in the $_POST arrary. It knows nothing of anything in the $_SESSION array. You will have to write your own script to email the information. It isn't very hard to do.

Ken
Link to comment
https://forums.phpfreaks.com/topic/32873-multiple-forms/#findComment-153041
Share on other sites

NickG21:  If all of the forms fields have the exact same names on all 6 pages then your problem is simple; because you're dynamically writing all of the $_POST elements to the $_SESSION array, every time that sequence of code is run, it overwrites your previous values you had set which is why you ONLY see the very last page's values in your session array.
Link to comment
https://forums.phpfreaks.com/topic/32873-multiple-forms/#findComment-153043
Share on other sites

all of the form names have different names and values on all of the forms, i thought this would make it easier to be able to decipher all of the information that is sent to the e-mail, and as for writing my own script, i do not have much of an idea where to start, i am pretty new to PHP, also i was wondering if the fact that i never close the session has anything to do with the variables not being sent?

thanks
Link to comment
https://forums.phpfreaks.com/topic/32873-multiple-forms/#findComment-153046
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.