Jump to content

Contact form help


tecmeister

Recommended Posts

Im having some trouble with the contact form that i have created.

This is the code that i have used on the first page:

<form method="POST" action="sendeail.php">
   Contact Name:<input type="text" name="name" size="30"><br>
   <br>
   Contact Company:<input type="text" name="company" size="30">
   <br>
<br>
   Contact Email:<input type="text" name="email" size="30"><br>
   <br>
   Message<br>
   <textarea rows="9" name="message" cols="50"></textarea>
   <br>
   <br>
   <input type="submit" value="Send Email" name="Submit">
</form>

 

Second page

 

?>
        
        <!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->

<?php
if(isset($_POST['submit'])) {

$to = "[email protected]";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$company_field = $_POST['company'];
$message = $_POST['message'];

$body = "From: $name_field\n E-Mail: $company_field\n Company; $email_field\n Message:\n $message";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);
}
?>

 

Thanks for the help

 

tecmeister

Link to comment
https://forums.phpfreaks.com/topic/94072-contact-form-help/
Share on other sites

I use a class for sending my emails php mailer see link below

 

http://phpmailer.codeworxtech.com/

 

It's a really good class and allow attachments and everything.

 

As long as your getting your "Data has been submitted to $to!" message the it's down to mail() with the issue.

 

Regards

Liam

 

 

BTW I know that feeling... I have a 6 month old girl lol

Link to comment
https://forums.phpfreaks.com/topic/94072-contact-form-help/#findComment-481908
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.