So, here is my code that executes when the form is submitted: (I am new)
<?php
if (!$firstName || !$lastName || !$dob || !$email){
echo 'You did not fill out all the required information';
exit;
}
if ($password !== $cpassword) {
echo 'Passwords did not match. Please go back and try again.';
exit;
}
if (strlen($password)<6 || strlen($password) >16){
echo 'Your password must be between 6 and 16 characters.'
.'Please go back and try again.';
exit;
}
$db = mysql_connect('localhost', 'database', 'password');
mysql_select_db( 'gwbrooks_MRSC',$db) or die ("Eat a dick I cant connect!");
$check = mysql_query("SELECT * FROM tblRegistered WHERE email = '$email'") or die(mysql_error());
$check2 = mysql_num_rows($check);
if ($check2 == 1) {
echo ('The user already exists. Please go back and try again.');
exit;
}
$query = "INSERT INTO tblRegistered(firstName, lastName, dob, email, password) VALUES
('".$firstName."', '".$lastName."', '".$dob."', '".$email."', '".$password."')";
$result = mysql_query($query);
if ($result)
echo '<p>Thank you for registering with the Mississauga Recreation Sports Club.</p>
<p>A confirmation email has been sent to you.</p>';
$recmail = $email; // address you want the form mailed to
$sub = "MRSC Registration" ; //subject of email that is sent
$mess =
'First Name: '.$firstName.'
Last Name: '.$lastName.'
Date of Birth: '.$dob.'
Email: '.$email.'
Password: '.$password.'
This is an automatically generated email. Please do not respond to it. Thanks for registering with MRSC.
Please click on the link below to confirm your registration';
$headers = 'From: mrsc@mrsc.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email,$sub,$mess,$headers);
?>
Can you tell me where would I insert the code and what should it look like?
Do I create a new page with the sha() coding?
Is there somewhere I can look at an example?
Thanks in advance for your time.