Jump to content

Recommended Posts

Hi, I am using the following form on my website to allow the users to send an email directly to my account. The PHP code seems fine to me, yet it isn't working. When I press send I am being taken to that page called "thankhyou.html" which implies to me that the email has been sent, yet I am not receiving any emails. I have tried using a different email address, yet this makes no difference. I have also tried hosting the pages on another server WHICH I KNOW FOR SURE IS COMPATIBLE WITH THE LATEST PHP. Still I have had no luck. Does anyone have any ideas? 

<form action="mail.php" method="POST">

<table>

<tr><td>Name: </td><td><input type="text" name="name"></td></tr>

<tr><td>Email: </td><td><input type="text" name="email"></td></tr>

<tr><td>Subject: </td><td><input type="text" name="subject"></td></tr>

<td>Message: </td><td><textarea style="width: 200px; height: 90px; " name="message"></textarea></td>

<td colspan="2"><input type="submit" value="Send"></td>

<td colspan="2"><input type="reset" value="Reset"></td></tr>

</table>

</form>

 

<?php

 

if(isset($_POST['name'])) {

 

$name = $_POST['name'] . "\n";

$email = $_POST['email'] . "\n";

$subject = $_POST['subject'] . "\n";

$messageorig = $_POST['message'] . "\n";

 

$message = "Name: $name " . "\n";

$message .= "Email: $email " . "\n";

$message .= "Message: $messageorig " . "\n";

 

if(mail("root@heathfieldresidentialhome.co.uk", $subject, $message, "From: Contact Form")) {

        header("Location: thankyou.html");

} else {

        echo "Mail sending failed";

}

 

}

?>

Link to comment
https://forums.phpfreaks.com/topic/104127-problems-with-an-html-form/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.