Markx Posted September 28, 2008 Share Posted September 28, 2008 Hi All I'm stuck with a problem. I've got 3 pages. 1) A form which asks for a name of a user. 2) Uses name and then also posts new information from checkboxes to sendmail.php 3) Is sendmail.php The problem is I need sendmail.php to find what name is from the first page. The 1st page uses GET to send the information to 2nd page. sendmail.php contains a lot of $c18=$_REQUEST['checkbox']; $c183=$_REQUEST['checkbox2']; $c19=$_REQUEST['checkbox3']; etc but I can't seem to REQUEST the name from the 1st page I hope you can help Thanks Markx Quote Link to comment https://forums.phpfreaks.com/topic/126169-solved-forms-variable-help/ Share on other sites More sharing options...
ratcateme Posted September 28, 2008 Share Posted September 28, 2008 you could use sessions to save the info from the first form then recall it at the second from you could do something like this //page 2 session_start(); $_SESSION['first_form_data'] = $_REQUEST; //page 3 session_start(); $username = $_SESSION['first_form_data']['username']; $name = $_SESSION['first_form_data'][name]; Scott. Quote Link to comment https://forums.phpfreaks.com/topic/126169-solved-forms-variable-help/#findComment-652440 Share on other sites More sharing options...
CroNiX Posted September 28, 2008 Share Posted September 28, 2008 It would be best to use a session. page 1 asks user name in a form and sends to page 2. page 2: <?php session_start(); $_SESSION['username'] = $_POST['username']; //make sure the $_POST username gets sanitized first page 3: <?php session_start(); $username = $_SESSION['username']; you must use session_start() on each page (at the top is best) in order for this to work. **EDIT**: ratcatme beat me to it Quote Link to comment https://forums.phpfreaks.com/topic/126169-solved-forms-variable-help/#findComment-652441 Share on other sites More sharing options...
Markx Posted September 28, 2008 Author Share Posted September 28, 2008 Hi Both Thank you for that. It's working great. Next problem... I'm trying to send the information via email using $message = ",$first,$second,$third,$fourth,$fifth,$sixth,$seventh" mail("mark@ignitiondrivingschool.com","Holiday form", $message ); It comes back with Parse error: syntax error, unexpected T_STRING in /home/ignition/public_html/instructor/sendform.php on line 250 I've used echo on all the $first etc and it works fine. The mail command is practically the same as an existing one I use for a completely different form. Any further help would be great Markx Quote Link to comment https://forums.phpfreaks.com/topic/126169-solved-forms-variable-help/#findComment-652485 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.