Hello,
I need to do the following:
I have 2 forms on two different pages:
Form 1: Name, Email, Phone
Form 2: Name, Email, Phone, Address, etc.
1. User fills out Form 1, presses submit
2. Form 1 gets processed and I receive an email with the visitors Name, Email, Phone
3. After the Form has been processed I need to redirect the visitor to a new page (Form 2)
4. When Form 2 loads, fill in the form with the posted variables (Name, Email, Phone) from the previous process
Here is my code:
Form 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form method="post" action="process_form.php">
<input type="text" name="name" />
<input type="text" name="email" />
<input type="text" name="phone" />
<input type="submit" name="submit" value="submit" />
</form>
</div>
</body>
</html>
process_form.php
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$to = 'email@provider.com';
$subject = "Contact Form";
$message =
"Contact Information\r\n"
."$name\r\n"
."$email\r\n"
."$phone\r\n\";
$headers = "From: $email\r\n";
mail($to, $subject, $message, $headers);
// Redirect
header("Location: http://www.domain.com/form2/");
?>
Form 2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form method="post" action="process_form_2.php">
<input type="text" name="name" />
<input type="text" name="email" />
<input type="text" name="phone" />
<input type="text" name="address" />
<input type="text" name="city" />
<input type="text" name="state" />
.
.
.
<input type="submit" name="submit" value="submit" />
</form>
</div>
</body>
</html>
The form does get processed and I do get an email with the visitor's info. But I'm not able to pass on the variables from From1 to Form2.
Thank you in advance.