Hi All,
I'm just setting up a registration page, which seems to be working ok at the moment. However, i would like to add an email confirm field so that the two fields have to match before the form is submitted. I've attached the code i have below with the 'Email' and Emailconfirm' being to two fields that would need to match. Could someone supply me with either the code i need or where i could sort out the code. I'm learning php at the moment so it has taken me a bit of time to get where i am, but hopefully this is the last hurdle to complete the form.
Many thanks,
Keith
PHP Code:<?php
$from = $_REQUEST['Email'] ;
$email = $_REQUEST['Emailconfirm'] ;
$name = $_REQUEST['Name'] ;
$Reference = $_REQUEST['Reference'] ;
$Forname = $_REQUEST['Christian-name'] ;
$Street = $_REQUEST['Street'] ;
$Town = $_REQUEST['Town'] ;
$Post = $_REQUEST['Post-code'] ;
$country = $_REQUEST['country'] ;
$headers = "From: $from";
$subject = "*******";
$fields = array();
$fields{"Reference"} = "Reference";
$fields{"Name"} = "Name";
$fields{"Christian-name"} = "Christian-name";
$fields{"Institution"} = "Institution";
$fields{"Street"} = "Street";
$fields{"Town"} = "Town";
$fields{"Post-code"} = "Post-code";
$fields{"country"} = "country";
$fields{"Telephone"} = "Telephone";
$fields{"Email"} = "Email";
$to = "*******.co.uk";
$body = "******* details:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: *******";
$subject2 = "*******";
$autoreply = "
Thank you for registering with the The *******.
http://www.*******
Surname: $name
Reference number: $Reference
-------------------------------------------
*
This e-mail is confidential and intended for the addressee (s) only. It may also be privileged. If you are not the intended recipient, please notify the sender by replying to this e-mail. You should not copy this e-mail or otherwise use it for any purpose and the contents must not be disclosed to any other person.";
if($from == '') {echo "You have not entered an email, please go back and try again";}
else {
if($name == '') {echo "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: *******" );}
else
{echo "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; }
}
}
?>
<?php
$headers = "From:*******".com\r\n";
$recipients = "*******".com";
mail($recipients, "This is the subject","This is the mail body", $headers);
?>



Reply With Quote




Bookmarks