Jump to content

Form problems


lillizzierae

Recommended Posts

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 = "[email protected]";

$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>

 

Link to comment
https://forums.phpfreaks.com/topic/89980-form-problems/
Share on other sites

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!

Link to comment
https://forums.phpfreaks.com/topic/89980-form-problems/#findComment-461370
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.