I have just about finished a very simple PHP contact form but I can't get it to work right. I will give someone a few bucks if they can straighten it out for me. Should only take a few minutes for someone with experience. Below is the contact form HTML and the link to what it looks like. http://www.bulldogsale.net/contact.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Form </title> </head> <body> <center> <form method="post" action="sendeail.php"> <!-- DO NOT change ANY of the php sections --> <input type="hidden" name="ip" value="69.250.98.26" /> <input type="hidden" name="httpref" value="" /> <input type="hidden" name="httpagent" value="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MediaPilot; MediaPilotAd; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)" /> Bulldog Breed: <br /> <input type="text" name="visitor" size="35" /> <br /> <br /> Price:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Description 350 Character Max:<br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /> <br /> Location, State:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Your Email:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Your Website Address:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Your First Name:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Your Last Name:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> <input type="submit" value="Send Mail" /><br /> </form> </center> </body> </html> This is the PHP that need to be fixed to match the Contact Form above. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> </head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> <?php if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; } if(empty($visitor) || empty($visitormail) || empty($notes )) { echo "<h2>Use Back - fill in all fields</h2>\n"; } $todayis = date("l, F j, Y, g:i a") ; $attn = $attn ; $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $visitormail\r\n"; mail("sales@danielmillions.com", $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br /> Attention: <?php echo $attn ?> <br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /> <?php echo $ip ?> <br /><br /> <a href="contact.php"> Next Page </a> </p> </body> </html> All the info from the contact form is supposed to go to my email account. Thanks for the help.
well first of all change the form input names on the html form. they cant all be name="visitormail". each one needs to be unique and represent what info they are inputing. like firstname, email, lastname, ect.. something easily recognized. that should help a bit ----- <form method="post" action="sendeail.php"> this should point to your php form processing file, is the name sendeail.php and not sendmail.php or sendemail.php? ----- visitormail is only used for the email address. this one below should not be renamed. Your Email:<br /> <input type="text" name="visitormail" size="35" /> ----- it also seems like a lot of your form inputs are being ignored like last name, dog breed, ect because they were not included into the message in the php form processing script. you would add it by doing the following: $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n \n\n First Name: $_POST['FormInputName']\n Last Name: $_POST['FormInputName']\n Dog Breed:$_POST['FormInputName']\n Price:$_POST['FormInputName']\n "; PHP:
The form actually works and sends info to my email address as it is. It was a free open source script but I added a few feilds to the form so I need to add the html to the php side of it. I have zero php experience so if anyone wants to fix it for me I am willing to pay 10 -15 bucks. thanks
in my post above i showed you how to include the new inputs into the email. you just need to add a unique name to the input and add the input into the email message.
Here you go all done ;-) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Form </title> </head> <body> <center> <form method="post" action="sendeail.php"> <!-- DO NOT change ANY of the php sections --> <input type="hidden" name="ip" value="69.250.98.26" /> <input type="hidden" name="httpref" value="" /> <input type="hidden" name="httpagent" value="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MediaPilot; MediaPilotAd; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)" /> Bulldog Breed: <br /> <input type="text" name="dogbreed" size="35" /> <br /> <br /> Price:<br /> <input type="text" name="price" size="35" /> <br /> <br /> Description 350 Character Max:<br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /> <br /> Location, State:<br /> <input type="text" name="location" size="35" /> <br /> <br /> Your Email:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Your Website Address:<br /> <input type="text" name="site" size="35" /> <br /> <br /> Your First Name:<br /> <input type="text" name="fname" size="35" /> <br /> <br /> Your Last Name:<br /> <input type="text" name="lname" size="35" /> <br /> <br /> <input type="submit" value="Send Mail" /><br /> </form> </center> </body> </html> This is the PHP that need to be fixed to match the Contact Form above. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> </head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> <?php if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; } if(empty($visitor) || empty($visitormail) || empty($notes )) { echo "<h2>Use Back - fill in all fields</h2>\n"; } $todayis = date("l, F j, Y, g:i a") ; $attn = $attn ; $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n \n\n First Name: $_POST['fname']\n Last Name: $_POST['lname']\n Dog Breed: $_POST['dogbreed']\n Price: $_POST['price']\n Location: $_POST['location']\n Site: $_POST['site']\n "; $from = "From: $visitormail\r\n"; mail("sales@danielmillions.com", $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br /> Attention: <?php echo $attn ?> <br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /> <?php echo $ip ?> <br /><br /> <a href="contact.php"> Next Page </a> </p> </body> </html>
Julus thanks for the help but I know get the error below when I click submit. http://www.bulldogsale.net/sendeail.php Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/b/u/l/bulldogman1B/html/sendeail.php on line 43
I had many problems with these contact form scripts and finally found this script which i guess a friend of mine(dp member) made for me http://www.123contactform.com/ You also get a image verification option Live Demo I would say highly recommended
http://vdrives.net/test2.html form http://vdrives.net/test.php form processing lol there that should do it. --------- html --------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Form </title> </head> <body> <center> <form method="post" action="test.php"> <!-- DO NOT change ANY of the php sections --> <input type="hidden" name="ip" value="69.250.98.26" /> <input type="hidden" name="httpref" value="" /> <input type="hidden" name="httpagent" value="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MediaPilot; MediaPilotAd; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)" /> Bulldog Breed: <br /> <input type="text" name="dogbreed" size="35" /> <br /> <br /> Price:<br /> <input type="text" name="price" size="35" /> <br /> <br /> Description 350 Character Max:<br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /> <br /> Location, State:<br /> <input type="text" name="location" size="35" /> <br /> <br /> Your Email:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Your Website Address:<br /> <input type="text" name="site" size="35" /> <br /> <br /> Your First Name:<br /> <input type="text" name="fname" size="35" /> <br /> <br /> Your Last Name:<br /> <input type="text" name="lname" size="35" /> <br /> <br /> <input type="submit" value="Send Mail" /><br /> </form> </center> </body> </html> ---------- processor ---------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> </head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> <?php $vistormail = $_POST['visitormail']; $notes = $_POST['notes']; $firstName = $_POST['fname']; $lastName = $_POST['lname']; $dogBreed = $_POST['dogbreed']; $price = $_POST['price']; $location = $_POST['location']; $site = $_POST['site']; if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))){ echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; } if((!$visitormail) || (!$visitormail) || (!$notes )){ echo "<h2>Use Back - fill in all fields</h2>\n"; } $todayis = date("l, F j, Y, g:i a"); $attn = $attn; $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n \n\n First Name: $firstName\n Last Name: $lastName\n Dog Breed: $dogBreed\n Price: $price\n Location: $location\n Site: $site\n "; $from = "From: $visitormail\r\n"; mail("sales@danielmillions.com", $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $_POST['fname'] .' '. $_POST['lname'] ?> ( <?php echo $_POST['visitormail']; ?> ) <br /> Attention: <?php echo $attn ?> <br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $_POST['notes']); echo $notesout; ?> <br /> <?php echo $ip ?> <br /><br /> <a href="contact.php"> Next Page </a> </p> </body> </html>
-------- minor update: switch: if((!$visitormail) || (!$visitormail) || (!$notes )){ echo "<h2>Use Back - fill in all fields</h2>\n"; } PHP: for this: if( (strlen($visitormail) || strlen($notes)) == 0){ echo "<h2>Use Back - fill in all fields</h2>\n"; } PHP:
Thanks Julus works great now, Could I get you to add one more feild to the contact form for me? Under "Price" could you add "Url of Image" Also could you send or post your Paypal email address. Thanks again for all the help.
here you go: ------- html ------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Form </title> </head> <body> <center> <form method="post" action="test.php"> <!-- DO NOT change ANY of the php sections --> <input type="hidden" name="ip" value="69.250.98.26" /> <input type="hidden" name="httpref" value="" /> <input type="hidden" name="httpagent" value="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MediaPilot; MediaPilotAd; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)" /> Bulldog Breed: <br /> <input type="text" name="dogbreed" size="35" /> <br /> <br /> Price:<br /> <input type="text" name="price" size="35" /> <br /> <br /> Url of Image:<br /> <input type="text" name="image" size="35" /> <br /> <br /> Description 350 Character Max:<br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /> <br /> Location, State:<br /> <input type="text" name="location" size="35" /> <br /> <br /> Your Email:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> Your Website Address:<br /> <input type="text" name="site" size="35" /> <br /> <br /> Your First Name:<br /> <input type="text" name="fname" size="35" /> <br /> <br /> Your Last Name:<br /> <input type="text" name="lname" size="35" /> <br /> <br /> <input type="submit" value="Send Mail" /><br /> </form> </center> </body> </html> --------- processor --------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> </head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> <?php $vistormail = $_POST['visitormail']; $notes = $_POST['notes']; $firstName = $_POST['fname']; $lastName = $_POST['lname']; $dogBreed = $_POST['dogbreed']; $price = $_POST['price']; $location = $_POST['location']; $site = $_POST['site']; $image = $_POST['image']; if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))){ echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; exit; } if( (strlen($visitormail) || strlen($notes) || strlen($fname) || strlen($lname) || strlen($dogbreed) || strlen($price)) == 0){ echo "<h2>Use Back - fill in all fields</h2>\n"; exit; } $todayis = date("l, F j, Y, g:i a"); $attn = $attn; $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n \n\n First Name: $firstName\n Last Name: $lastName\n Dog Breed: $dogBreed\n Price: $price\n Location: $location\n Site: $site\n Image Url: $image\n "; $from = "From: $visitormail\r\n"; mail("sales@danielmillions.com", $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $_POST['fname'] .' '. $_POST['lname'] ?> ( <?php echo $_POST['visitormail']; ?> ) <br /> Attention: <?php echo $attn ?> <br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $_POST['notes']); echo $notesout; ?> <br /> <?php echo $ip ?> <br /><br /> <a href="contact.php"> Next Page </a> </p> </body> </html>
Thanks a millions Juls I was struggling with that for a while works great. Could you PM me your Paypal email.
no problem. glad I could help. pm sent. let me know if you want to change or add anything, it should be simple to add to it. i can show you how, if you like.