smit2685 Posted August 22, 2008 Share Posted August 22, 2008 Can anyone help me with my code? I just want the results emailed to me. I must not be understanding the "if" statement very well.. Any help would be greatly appreciated!! This is the error I get when I try and use the form.... Parse error: syntax error, unexpected '{' in /home/dppiatsn/public_html/test/Certified_construction/contact_form_response.php on line 24 Here is my form: <form action="contact_form_response.php" method="post" name="EstimateForm"> <table width="520" border="0" cellspacing="5"> <tr> <td width="103"><label for="name"> Name:</label></td> <td width="383"><input name="name" type="text" id="name" size="22" /></td> </tr> <tr> <td width="103"><label for="address"> Address:</label></td> <td><input name="address" type="text" id="address" size="40" /></td> </tr> <tr> <td width="103"><label for="phone"> Phone:</label></td> <td><input name="phone" type="text" id="phone" size="20" /></td> </tr> <tr> <td width="103"><label for="email"> Email:</label></td> <td><input name="email" type="text" id="email" size="25" /></td> </tr> <tr> <td width="103"><label for="time"> Best Time <br>to Contact:</label></td> <td><input type="text" name="time" id="time" /></td> </tr> <tr> <td width="103" height="127"><label for="comments"> Comments:</label></td> <td><textarea name="comments" id="comments" cols="45" rows="8"></textarea></td> </tr> <tr> <td height="38"> </td> <td><label for=" submit "></label> <input type="submit" name=" submit " id=" submit " value="Submit" /></td> </tr> </table> ----------------- Here is my script: <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title> Contact Form Response <title> </head> <body> <?php $name = $_POST['name']; $address = $_POST['address']; $phone = $_POST['phone']; $email = $_POST['email']; $time = $_POST['time']; $comments = $_POST['comments']; //validation if(3 < strlen($name) && 3 <strlen($address) && 3 < strlen($phone) && 3 <strlen($email && 3 < strlen($time) && 3 < strlen($comments)) { } else { echo "You did not fill in the form properly. Please use the browswer's "back" button and update the form."; } $email_message = <<< EMAIL Message from Website Form. Name: $name Address: $address Phone: $phone Email: $email Best time to contact: $time Message: $comments EMAIL; if(mail('XxxxxXXXxxxXX','WebForm Email', $email_message)) { echo "Your email has been delivered, we will contact you shortly."; } else { echo "We had a problem sending the email."; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/120937-contact-form-scriptwhat-am-i-mising-here/ Share on other sites More sharing options...
ratcateme Posted August 22, 2008 Share Posted August 22, 2008 you are missing a ) from your if statement i am not sure where but u need to add one in Scott. Link to comment https://forums.phpfreaks.com/topic/120937-contact-form-scriptwhat-am-i-mising-here/#findComment-623407 Share on other sites More sharing options...
JREAM Posted August 22, 2008 Share Posted August 22, 2008 //validation You were missing a ) in here if(3 < strlen($name) && 3 <strlen($address) && 3 < strlen($phone) && 3 <strlen($email) && 3 < strlen($time) && 3 < strlen($comments)) { NULL; } else { // You forgot to \ your " echo "You did not fill in the form properly. Please use the browser's \"back\" button and update the form."; } Link to comment https://forums.phpfreaks.com/topic/120937-contact-form-scriptwhat-am-i-mising-here/#findComment-623408 Share on other sites More sharing options...
smit2685 Posted August 23, 2008 Author Share Posted August 23, 2008 Thanks alot! that is my first php script Link to comment https://forums.phpfreaks.com/topic/120937-contact-form-scriptwhat-am-i-mising-here/#findComment-623482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.