Jump to content

SjCBalls

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by SjCBalls

  1. I have a registration for m on my website and it only sends me the required fields upon user submitting form, the optional fields, even when filled out does not get sent? I do not know what I am doing wrong, Can you please check this php file and see if there is an obvious error I cannot find? Please help as I am completely new to this and am building the website for a community sports club in my free time. I have attached the html page to this request in case it helps. Thanks in advance <?php $myemail = "info@gtta.gi"; $email_subject = "Registration Form"; $name = check_input($_POST['name'], "Enter your Name"); $email = check_input($_POST['email'], "Please Enter your Email"); $phone = check_input($_POST['phone'], "Enter your contact number"); $text = check_input($_POST['text']); $gender = check_input($_POST['gender']); $do = check_input($_POST['do']); $address = check_input($_POST['address']); $played = check_input($_POST['played']); if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid");} $message = "Hello! The Registration form has been submitted by: Name: $name E-mail: $email Phone: $phone DOB: $text Gender: $gender What they do: $do Address: $address Played?: $played"; mail($myemail, $subject, $message); header('Location: thanks.html'); exit(); function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <body> <b>Please correct the following error:</b><br /><?php echo $myError; ?> </body> </html> <?php exit(); } ?> registergtta.html
×
×
  • Create New...