Page 2 of 2
Re: Form isn't sending emails or displaying html upon submis
Posted: Tue Sep 27, 2011 5:39 am
by Celauran
Which, based on the code below, means either QL_Name, Age, Country, or Game_Type aren't set. Double check your form.
Code: Select all
// 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.');
}
Re: Form isn't sending emails or displaying html upon submis
Posted: Wed Sep 28, 2011 11:13 am
by jaydoh73
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...
Code: Select all
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.
Re: Form isn't sending emails or displaying html upon submis
Posted: Wed Sep 28, 2011 11:18 am
by Celauran
"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?
Re: Form isn't sending emails or displaying html upon submis
Posted: Wed Sep 28, 2011 9:51 pm
by jaydoh73
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:
What am I missing here?
Code: Select all
<?php
$mymail = 'ordietryingodt@yahoo.com';
$cc = 'New Recruit To Add!';
$BoDy = ' ';
$FrOm = 'FROM:' .$_POST['t1'];
$FrOm .= 'Reply-To:' .$_POST['t1'];
$FrOm .= 'X-MAILER: PHP'.phpversion();
$BoDy .= 'Quake Live Name: ';
$BoDy .= $_POST['t1'];
$BoDy .= "\n";
$BoDy .= 'Age: ';
$BoDy .= $_POST['t2'];
$BoDy .= "\n";
$BoDy .= 'Residing Country: ';
$BoDy .= $_POST['t3'];
$BoDy .= "\n";
$BoDy .= 'Favorite Game Type: ';
$BoDy .= $_POST['t4'];
$BoDy .= "\n";
$send = mail("$mymail", "$cc", "$BoDy", "$FrOm");
if($send)
{
echo '<html><head>';
echo '<meta http-equiv="refresh" content="0;URL=/submitted.htm">';
echo '</head><body>Email send....';
echo '</body></html>';
}
?>