lillizzierae Posted February 7, 2008 Share Posted February 7, 2008 I have a simple form I made for my site that works but I decided not to use it and just go with the "Email me at:" so on. A friend of mine needed a form and I figured since my old form worked that it would work on his site too.. but it doesn't. I used the exact code for the form and for the php. I don't know why. I tested it again on my site and it works. I receive the mail. So why doesn't it work on his? We both go through two different hosting. Here's the php. The only changes I made was I switched my URL to his and right now I'm using my email address. <!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" /> <meta http-equiv="refresh" content="5; url=http://sandblandscaping.com"> <title></title> </head> <body> <?php if(isset($_POST['submit'])) { $to = "lillizzierae@aol.com"; $subject = "Contact Form"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; echo "Thank you! Your mail has been sent. In 5 seconds you'll be directed back to the homepage."; mail($to, $subject, $body); } else { echo "Go back"; } ?> <br /> Back to <a href="http://sandblandscaping.com">sandblandscaping.com</a> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/89980-form-problems/ Share on other sites More sharing options...
revraz Posted February 7, 2008 Share Posted February 7, 2008 Possible that your php.ini has a standard FROM: header in it, and his doesn't. So if you try adding that to the mail() function, it may work. He can also check his error logs on why it's failing. Quote Link to comment https://forums.phpfreaks.com/topic/89980-form-problems/#findComment-461324 Share on other sites More sharing options...
lillizzierae Posted February 8, 2008 Author Share Posted February 8, 2008 I tried what you said but it didn't work. It actually made it work less and that probably doesn't make sense. When I click submit (on either mine or his form) they both show that it was submitted. The only difference is when I click submit on his I don't receive any mail; on the identical form on my site I receive mail. When I added the header and clicked submit it didn't allow the page to load and I still didn't receive any mail. I checked for errors and there aren't any. Grr! Quote Link to comment https://forums.phpfreaks.com/topic/89980-form-problems/#findComment-461370 Share on other sites More sharing options...
revraz Posted February 8, 2008 Share Posted February 8, 2008 Lets see the header you added. Is error logging on? Quote Link to comment https://forums.phpfreaks.com/topic/89980-form-problems/#findComment-461382 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.