Hey, trying to make a basic PHP contact form for my website.
Currently i have a contact.html page which this bit of code for the form bit:
And then i have a report2.php file which has this bit of code in:
Is there something i've done wrong, or have i not set it up right?
Thanks
Currently i have a contact.html page which this bit of code for the form bit:
Code:
<p class="style1">Contact me:</p>
<form method="POST" action="report2.php">
<p>Name:
<input type="text" name="name" size="19">
<br>
<br>
Email:
<input type="text" name="email" size="19">
<br>
</p>
<p>Message:<br>
<textarea rows="7" name="message" cols="50"></textarea>
<br>
<br>
<input type="submit" value="Submit" name="submit">
</p>
</form>
And then i have a report2.php file which has this bit of code in:
Code:
<?php
if(isset($_POST['submit'])) {
$to = "[email protected]";
$subject = "Website Feedback 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 "Thanks for your email!";
mail($to, $subject, $body);
} else {
echo "The email hasn't worked, please try again!";
}
?>
Is there something i've done wrong, or have i not set it up right?
Thanks
