So I was able to get the user all the way to the thank you page, but when I check my email (which is correct in the real code), I had nothing. any help would be appreciated.
<?php
$myemail = "myEmailInAString@gmail.com";
$name = check_input($_POST['full_name'], "Enter your name");
$phone = check_input($_POST['phone'], "Enter a phone number");
$email = check_input($_POST['email']);
$address = check_input($_POST['address'], "Enter your address");
$city = check_input($_POST['city'], "Enter your city");
$state = check_input($_POST['state'], "Enter your state");
$zip_code = check_input($_POST['zip_code'], "Enter your zip_code");
$asking_price = check_input($_POST['asking_price'], "Enter your asking_price");
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)){
show_error("E-mail address not valid");
}
$message = "
Name: $name
E-mail: $email
Phone Number: $phone
Address: $address
$city, $state, $zip_code
Asking Price: $asking_price";
mail($myemail, "$city Inquiry", $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>
<p>Please correct the following error:</p>
<strong><?php echo $myError; ?></strong>
<p>Hit the back button and try again</p>
</body>
</html><?php
exit();
}
?>
also, any tips on php forms would be greatly appreciated. I am a total noob when it comes to forms...