Email/Registration Form
Hi, I need to create a form that emails a list of information, and then when submitted, will redirect to the payment page. This is for a conference, and this information is needed prior to receiving the pay. This is where I am at right now:
<form method="post" action="registration-form.php">
<p>First Name:<br /><input name="firstname" type="text"><br /></p>
<p>Last Name:<br /><input name="lastname" type="text"><br /></p>
<p>T-Shirt Size:<br /><input type="radio" name="tshirt" value="Small"> S <input type="radio" name="tshirt" value="Medium"> M <input type="radio" name="tshirt" value="Large"> L <input type="radio" name="tshirt" value="Extra Large"> XL<br /></p>
<p>Mailing Address:<br /><input name="mailing" type="text"><br /></p>
<p>Postal Code:<br /><input name="postalcode" type="text"><br /></p>
<p>City:<br /><input name="city" type="text"><br /></p>
<p>School:<br /><input name="school" type="text"><br /></p>
<p>Phone Number:<br /><input name="phone" type="text"><br /></p>
<p>Email Address:<br /><input name="email" type="text"><br /></p>
Additional information or requests: <br /><textarea name="request" rows="3" cols="40"></textarea><br />
<input type="submit" value="Continue to Payment">
</form>
And the .php:
<?
ob_start();
// do stuff here
$url = 'URL GOES HERE';
// clear out the output buffer
while (ob_get_status())
{
ob_end_clean();
}
// no redirect
header( "Location: $url" );
?>
<?php
$to = "mikemueller2112@gmail.com";
$subject = "Registration Information";
$email = $_REQUEST['email'] ;
$firstname = $_REQUEST['firstname'] ;
$lastname = $_REQUEST['lastname'] ;
$tshirt = $_REQUEST['tshirt'];
$mailing = $_REQUEST['mailing'];
$postalcode = $_REQUEST['postalcode'];
$city = $_REQUEST['city'];
$school = $_REQUEST['school'];
$phone = $_REQUEST['phone'];
$message = $_REQUEST['message'];
$headers =
"First Name: $firstname
Last Name: $lastname
T-Shirt Size: $tshirt
Mailing Address: $mailing
Postal Code: $postalcode
City: $city
School: $school
Phone Number: $phone
Email Address: $email
Additional Information and/or Requests:";
$sent = mail($to, $subject, $message, $headers) ;
if($sent) {print "Your mail was sent successfully"; }
else {print "We encountered an error sending your mail"; }
?>
Now, what I need to do is, make sure all the information, except the last box, is filled out, before redirecting to the last page. And is it possible for php to refresh the page with new text printed by the form, or can it only print a new message like the above?
Please tell me what is wrong with the above code, I'm very limited with .php, and the first bit of code was how I could redirect it, but it will do it everytime I press the submit button on the form; I don't want this if the form is missing information.
Thanks in advance!
|