Hi everyone,
I was referred from the Via forums (been a longtime member there) because I had a PHP question there most couldn't answer.
After ten years of HTML, I finally learned how to do forms without using Outlook to send the message. Yeah, I know - slow learner.
I'm impressed with PHP but seem to get an error when I have more than four "items" being mailed to my email.
My site is: I have the "Send Question" part working... here is my code for the .php page (without the html headers:
<?php
$errors = "";
if (!$_POST['name'])
$errors .= "Your name is required - Please try again\n";
if (!$_POST['question'])
$errors .= "No question was submitted - Please try again\n";
if (!$_POST['emph'])
$errors .= "Either your email address or phone number is required - Please try again\n";
if ($errors)
echo $errors;
else {
$recipient = 'jamie@fourpeaksplanning.com';
$name = $_POST['name'];
$question = $_POST['question'];
$reach = $_POST['emph'];
$subject = "Website Question from $name";
$quests = "The question: $question";
$reachme = "How to contact: $reach";
mail($recipient, $subject, $reachme, $quests);
$errors = "Thank you $name for using our services. <br> <br>You will be contacted within the next 24 hours.";
echo $errors;
}
?>
I use to have the name of the sender being mailed to me but I kept getting syntax errors, parse erros, etc (yeah - I know you'd like exact error messages but I didn't write them down last night). So know the name of the sender is in the subject line.
When I had five items being mailed, I'd swap the last item with the first, the second, the third... and it was always an error with the last one. And I'm gotten errors when I tried to go with six items, saying it expected five. That could be a problem for my "Request Apptment" button. How do I get around that?
Thanks in advance for all your help.
I was referred from the Via forums (been a longtime member there) because I had a PHP question there most couldn't answer.
After ten years of HTML, I finally learned how to do forms without using Outlook to send the message. Yeah, I know - slow learner.
I'm impressed with PHP but seem to get an error when I have more than four "items" being mailed to my email.
My site is: I have the "Send Question" part working... here is my code for the .php page (without the html headers:
<?php
$errors = "";
if (!$_POST['name'])
$errors .= "Your name is required - Please try again\n";
if (!$_POST['question'])
$errors .= "No question was submitted - Please try again\n";
if (!$_POST['emph'])
$errors .= "Either your email address or phone number is required - Please try again\n";
if ($errors)
echo $errors;
else {
$recipient = 'jamie@fourpeaksplanning.com';
$name = $_POST['name'];
$question = $_POST['question'];
$reach = $_POST['emph'];
$subject = "Website Question from $name";
$quests = "The question: $question";
$reachme = "How to contact: $reach";
mail($recipient, $subject, $reachme, $quests);
$errors = "Thank you $name for using our services. <br> <br>You will be contacted within the next 24 hours.";
echo $errors;
}
?>
I use to have the name of the sender being mailed to me but I kept getting syntax errors, parse erros, etc (yeah - I know you'd like exact error messages but I didn't write them down last night). So know the name of the sender is in the subject line.
When I had five items being mailed, I'd swap the last item with the first, the second, the third... and it was always an error with the last one. And I'm gotten errors when I tried to go with six items, saying it expected five. That could be a problem for my "Request Apptment" button. How do I get around that?
Thanks in advance for all your help.