RE: [HELP] Website Functions! 12-15-2013, 07:27 PM
#15
(12-15-2013, 07:26 PM)Anizeb Wrote: Have you moved the PHP to another page?
Makes things easier.
Code:<form method="post" name="contact" id="contact" action="send.php"> <table> <tr> <td>Your Email Address</td> <td><input type="text" name="email"></td> </tr> <tr> <td>Subject</td> <td><textarea type="text" name="subject"></textarea></td> </tr> <tr> <td>Your Message</td> <td><textarea type="text" name="message"></textarea></td> </tr> <tr> <td><input type="submit" value="Submit" /></td> </tr> </table> </form>
and you now add the PHP to a file called "send.php"
Only mentioning this because your form originally submitted to itself, and I didn't know if you set up the page right.
Yeah the php is already in another file. What I mean was that for example, the form name, in the php is says 'email' but in the html, it's 'contact'. Shall I change this?
html:
Code:
<form action="email.php" method="post" name="contact" id="contact">
<table>
<tr>
<td>Your Email Address</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td>Subject</td>
<td><textarea type="text" name="subject"></textarea></td>
</tr>
<tr>
<td>Your Message</td>
<td><textarea type="text" name="message"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
</form>PHP
Code:
<?php
$mail = $_POST['email'];
$to = 'cbc-chat@hotmail.com';
$subject = 'Contact Form:' . $_POST['subject'];
$message = $_POST['message'];
$headers = 'From: ' . $mail . "\r\n" .
'Reply-To: ' . $mail . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
(This post was last modified: 12-15-2013, 07:33 PM by Eclipse.)














![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)