One confirmation email, two different forms.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sisleysusie
Forum Newbie
Posts: 16
Joined: Wed Jan 14, 2004 9:44 pm

One confirmation email, two different forms.

Post by sisleysusie »

Hi everyone,
I am totally new in web programming. Maybe my question sounds so silly for some of you, but i just wanna ask how to program forms in php which will accept multiple steps? For example form 1 post to form 2 then the consolidated results from both forms are posted via one email to the user? Basically i have a registration form, and then a billing form. So, i will need to send an email to the user about all the information that they have input in both forms. Currently i am using two forms which will send two different emails to the user. So, can anyone tell me how can i send only one email but the inputs are from two different forms? Thank you in advance :)
ilovetoast
Forum Contributor
Posts: 142
Joined: Thu Jan 15, 2004 7:34 pm

Post by ilovetoast »

There are several ways to do this.

First you could use sessions. Place all of the data from the first form into session vars and then combine those with the data from form 2 after the submission of form 2.

Another easier way (but with some privacy and kludge concerns) is to put the values from form 1 into a bunch of hidden form fields on form 2. Then they'll get passed on again when form 2 submits.

Sessions are best IMHO, so use them if you can. There are a number of good session references and tutorials around here if you do a search. Plus the PHP manual has solid info as well.

peace
sisleysusie
Forum Newbie
Posts: 16
Joined: Wed Jan 14, 2004 9:44 pm

Post by sisleysusie »

So does it mean that i only need to add codes like below in my form1 and then link to form2? Do i need to use session as well in form2? Or i only need to use normal html code? Thank you in advance

Code: Select all

<?php
 session_start();
   		 $HTTP_SESSION_VARS['courses_registered'] = $HTTP_POST_VARS['Courses_Registered'];
		 $HTTP_SESSION_VARS['FirstName'] = $HTTP_POST_VARS['FistName'];
		 $HTTP_SESSION_VARS['LastName'] = $HTTP_POST_VARS['LastName'];
		 $HTTP_SESSION_VARS['Salutations'] = $HTTP_POST_VARS['Salutations'];
		 $HTTP_SESSION_VARS['Gender'] = $HTTP_POST_VARS['Gender'];
		 $HTTP_SESSION_VARS['Citizenship'] = $HTTP_POST_VARS['CountryofCitizenship']
		 $HTTP_SESSION_VARS['DOB'] = $HTTP_POST_VARS['DOB'];

?>
sisleysusie
Forum Newbie
Posts: 16
Joined: Wed Jan 14, 2004 9:44 pm

Post by sisleysusie »

And if the fields are empty, it will link to another page 'missing.html'. How can i code it? I tried to use echo but i doesnt show the missing.html page instead it print out the link. Can anyone help me? Thank you in advance
Post Reply