2 page php form
I need to pass the input/data from page 1 to page 2 and page 2 will then email the data to an email address. I found the below script for a website but it insert the data into a database. Can someone please help change the last part to emailing it? Thx.
<form method="post" action="form2.php">
<input type="text" name="name">
<input type="text" name="email_address">
<input type="submit" value="Go To Step 2">
//let's start the session
//store our posted values in the session variables
$_SESSION['name'] = $_POST['name'];
$_SESSION['email_address'] = $_POST['email_address'];
<form method="post" action="form3.php">
<input type="radio" name="membership_type" value="Normal">
<input type="radio" name="membership_type" value="Deluxe">
<input type="checkbox" name="terms_and_conditions">
<input type="submit" value="Go To Step 3">
//let's start our session, so we have access to stored data
//let's create the query
$insert_query = 'insert into subscriptions (
) values (
" . $_SESSION['name'] . ",
" . $_SESSION['email_address'] . ",
" . $_SESSION['membership_type'] . ",
" . $_SESSION['terms_and_conditions'] . "
//let's run the query
I found this website useful:
It has a number of options. Trust me it is safe I have used it on my websites.
P.S: The last part has mysql_query. What you need to use is the mail() function.
mail($to, $subject, $msg);
I am using something similar but I have 3 pages of form data and the session data seems to drop when you go to page 3. So from page 1 to 2, no problem, but when you go to page 3 the data from page 1 is lost (and session hasn't timed out). Any thoughts?
Wait I figured it out. I wasn't called session start before the header etc.