PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
// validation expected data exists
if (!isset($_POST['QL_Name']) ||
!isset($_POST['Age']) ||
!isset($_POST['Country']) ||
!isset($_POST['Game_Type']))
{
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
Everything looks good on the html end & all of the input values are named just as they are in the php script.. I can only assume it's an error in the script itself...
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error . "<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
if (!isset($_POST['QL_Name']) ||
!isset($_POST['Age']) ||
!isset($_POST['email']) ||
!isset($_POST['Country']) ||
!isset($_POST['Game_Type'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$QL_Name = $_POST['QL_Name']; // required
$Age = $_POST['Age']; // required
$Email = $_POST['email']; // required
$Country = $_POST['Country']; // required
$Game_Type = $_POST['Game_Type']; // not required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$Country = "/^[A-Za-z .'-]+$/";
if (!preg_match($string_exp, $QL_Name))
{
$error_message .= 'Please enter your QL name.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if (!preg_match($string_exp, $Age))
{
$error_message .= 'Please enter your age.<br />';
}
if (!preg_match($string_exp, $Country))
{
$error_message .= 'Please enter your residing country.<br />';
}
if (strlen($error_message) > 0)
{
died($error_message);
}
I compared my processing script to the example I worked off of line by line & it the same to me.
"We are sorry, but there appears to be a problem with the form you submitted." only appears in one place, so the error has to be there. Have you looped through the $_POST array?
I've simplified the whole form & process by scrapping the validation & cleaning up the mail to info & redirection. I'll probably look into it again in the future, but it's not that important for this project & I need to get it up.
Everything works great except the body of the email doesn't contain the data entered into the fields.
Example...
Quake Live Name:
Age:
Residing Country:
Favorite Game Type: