Hi I am brand new to PHP Freaks and really hope someone can help me out with my php problem. I have a contact form that I am using and all the php and form info is in one file. The contact form worked before but it wasn't correct because one of the names was wrong on the form.
Here is the php I have put just below the opening body tag:
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$comment = $_POST["comment"];
$submit = $_POST["submit"];
if(isset($submit)){
$sendTo = "myemail@mydomain.com";
$message = "<h3>To You:</h3>
$comment<br />
<br />
From: $name ($email)";
$headers = "From: $name <$email> \r\n";
$headers .= "X-Mailer:PHP/\r\n";
$headers .= "MIME-Version:1.0\r\n";
$headers .= "Content-type:text/html; charset=iso-8859-1\r\n";
$sent = mail($sendTo, $subject, $message, $headers);
}
?>
and here is the form:
<form action="" method="post">
<table>
<tr>
<td>Name: </td>
<td><input type="text" name="name" class="field"/></td>
</tr>
<tr>
<td>Email: </td>
<td><input type="text" name="email" class="field" /></td>
</tr>
<tr>
<td>Subject: </td>
<td><input type="text" name="subject" class="field"/></td>
</tr>
<tr>
<td>Comment: </td>
<td><textarea name="comment" cols="30" rows="8" > </textarea></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Send" /></td>
</tr>
</table>
</form>
<?php
if ($sent){
echo "Thank you for your message!";
}
?>
now when I had it working I had accidentally had the subject name set to "email" but when I simply change it to "subject" as it should be it won't work anymore. I would love to just let it work the wrong way but this won't work because when I receive the email it displays the subject instead of the persons email and I need to see the email to get back to them.
I really hope someone can help me with this!
Thanks,
Curtis