Jump to content

[SOLVED] Trouble with php contact form


quarantine

Recommended Posts

I have a pretty straight forward contact form that should email to the specified email address, but when I fill out the form, and submit, it just takes me to a blank page on contact.php instead of echoing that my message has been sent....

 

contact.html

 

<html>

<head> <title>Contact Form</title></head>

<body>

<form method="post" action="contact.php">

Name:<input name="fullname" type="text">
<br /><br />
Email:<input name="email" type="text"><br />
<br />
Message: <br /><textarea rows="5" cols="50" name="
message">
Please type your message here!
</textarea>
<br/>
<br/>
<input type="submit" value="Submit">

</form>

</body>

</html>

 

 

contact.php

 

<?php

ini_set('display_errors','On'); 

// Grabing the info from the contact form

$name = $_POST['fullname']; 

$from = $_POST['email'];

$message = $_POST['message'];


// Email info and variables


$to = "[email protected]";

$subject = "Contact Form";

$body = "$message";

$headers = "From: $from" .

    "X-Mailer: php";

if (mail($to, $subject, $body, $headers)) {

  echo("<p>Message Sent!</p> <br /> <br /> Click <a href="#"> Here</a> to return to the main page.");

} else {

  echo("<p>Message delivery failed... Please hit back, and try again.</p>");
}
?>

 

Any suggestions?  :D :'(

 

-Thanks

Link to comment
https://forums.phpfreaks.com/topic/159923-solved-trouble-with-php-contact-form/
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.