Okay, im not a web desiger by any means, I am a graphic designer that works in print, and am using SiteGrinder to try and build this site. I have done forms before with no problem, but the problem is getting it to work on the websites hosting servers. They have things in place so people cant spam from their accounts. So the deal is when the user clicks “submit” everything looks like it worked just fine, but the emails never show up in my mailbox.\
The email address im trying to send these to is [email protected] and the form is located at www.aaadsok.com/register.html - I currently have this page not visible to the general public.
If there is more info you need, or if you need me to ask the hosting company anything that would help just let me know. Thanks!
1st off, Here is my php code for the form.
[php]<?php
if(($_POST[‘classstartdate’]=="")||($_POST[‘grade812’]=="")||($_POST[‘dateofbirth’]=="")||($_POST[‘studentlegallastname’]=="")||($_POST[‘studentlegalfirstname’]=="")||($_POST[‘guardianemail’]==""))
{
echo “
The following fields are required.
- ”;
- *class start date ”; }
- *grade [8 - 12] ”; }
- *date of birth ”; }
- *student legal last name ”; }
- *student legal first name ”; }
- *guardian email ”; }
if($_POST[‘classstartdate’] == “”){ echo “
if($_POST[‘grade812’] == “”){ echo “
if($_POST[‘dateofbirth’] == “”){ echo “
if($_POST[‘studentlegallastname’] == “”){ echo “
if($_POST[‘studentlegalfirstname’] == “”){ echo “
if($_POST[‘guardianemail’] == “”){ echo “
echo “
Please use your browsers <a href=“javascript:history.back();”>Back button and fill out these fields.
”;}
else
{
$message = “”;
$message .= "student cell: " . htmlspecialchars($_POST[‘studentcell’], ENT_QUOTES) . “
\n”;
$message .= "guardian cell 2: " . htmlspecialchars($_POST[‘guardiancell2’], ENT_QUOTES) . “
\n”;
$message .= "guardian cell 1: " . htmlspecialchars($_POST[‘guardiancell1’], ENT_QUOTES) . “
\n”;
$message .= "home phone: " . htmlspecialchars($_POST[‘homephone’], ENT_QUOTES) . “
\n”;
$message .= "zip: " . htmlspecialchars($_POST[‘zip’], ENT_QUOTES) . “
\n”;
$message .= "city: " . htmlspecialchars($_POST[‘city’], ENT_QUOTES) . “
\n”;
$message .= "address line 2: " . htmlspecialchars($_POST[‘addressline2’], ENT_QUOTES) . “
\n”;
$message .= "address line 1: " . htmlspecialchars($_POST[‘addressline1’], ENT_QUOTES) . “
\n”;
$message .= "*class start date: " . htmlspecialchars($_POST[‘classstartdate’], ENT_QUOTES) . “
\n”;
$message .= "school: " . htmlspecialchars($_POST[‘school’], ENT_QUOTES) . “
\n”;
$message .= "*grade [8 - 12]: " . htmlspecialchars($_POST[‘grade812’], ENT_QUOTES) . “
\n”;
$message .= "*date of birth: " . htmlspecialchars($_POST[‘dateofbirth’], ENT_QUOTES) . “
\n”;
$message .= "*student legal last name: " . htmlspecialchars($_POST[‘studentlegallastname’], ENT_QUOTES) . “
\n”;
$message .= "student legal middle name: " . htmlspecialchars($_POST[‘studentlegalmiddlename’], ENT_QUOTES) . “
\n”;
$message .= "*student legal first name: " . htmlspecialchars($_POST[‘studentlegalfirstname’], ENT_QUOTES) . “
\n”;
$message .= "student email: " . htmlspecialchars($_POST[‘studentemail’], ENT_QUOTES) . “
\n”;
$message .= "*guardian email: " . htmlspecialchars($_POST[‘guardianemail’], ENT_QUOTES) . “
\n”;
$lowmsg = strtolower($message);
$injection_strings = array ( “content-type:”,“charset=”,“mime-version:”,“multipart/mixed”,“bcc:”,“cc:”);
foreach($injection_strings as $suspect)
{
if((eregi($suspect, $lowmsg)) || (eregi($suspect, strtolower($_POST[‘name’]))) || (eregi($suspect, strtolower($_POST[‘email’]))))
{
die ( ‘Illegal Input. Go back and try again. Your message has not been sent.’ );
}
}
$headers = “MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n”;
$headers .= “From: “” . $_POST[‘name’] . “” <” . $_POST[‘email’] . “>\r\n”;
$headers .= “Reply-To: " . $_POST[‘email’] . “\r\n\r\n”;
mail("[email protected]”, “Student Registration”, $message, $headers);
header(“Location: thankyou.html”);
}
?>
[/php]
and this is the php file the web hosting company said needed to be in there also to make it work.
Here is the email they sent me “Just create feedback.php file with the following content and try. You will only need to replace [email protected] with desired email to send feedbacks to and yourhosteddomain.tld with domain name hosted on our server.”
I replaced my email [[email protected]] and my host domain [aaadsok.com] in the first lines below, although im not 100% sure i did it correctly.
Also near the end of that email it says “Your Email” I put the address I wanted the info to go to, is that correct to do ?
[php]<?php
$mail_to_send_to = “[email protected]”;
$your_feedbackmail = “[email protected]”;
$sendflag = $_REQUEST['sendflag'];
if ( $sendflag == "send" )
{
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $your_feedbackmail" . "\r\n" . "Reply-To: $email" . "\r\n" ;
$a = mail( $mail_to_send_to, "Feedback Form Results", $message, $headers );
if ($a)
{
print("Message was sent, you can send another one");
} else {
print("Message wasn't sent, please check that you have changed emails in the bottom");
}
}
?>
Your Email:Message:
[/php]