Submitting html forms to email problem
Posted: Sat Sep 20, 2008 7:19 am
Hi , i just started with php .
Im trying to submit an html form to an email address but the code is not working
for some reason . I already uploaded it to the server , but i cant figure out what is the problem with the code
HTML
PHP (submitform.php)
Im trying to submit an html form to an email address but the code is not working
for some reason . I already uploaded it to the server , but i cant figure out what is the problem with the code
HTML
Code: Select all
<form action="submitform.php" method="post">
<div id="contactUsForm">Name: <br>
<input type="text" name="nameTextBox" id="nameTextBox" /></p>
<p>Subject:<br>
<input type="text" name="subTextBox" id="subTextBox" /></p>
<p>Email: <br>
<input type="text" name="emailTextBox" id="emailTextBox" /></p>
<p>Message:<br>
<textarea name="msgTextBox" cols="50" rows="7" id="msgTextBox"></textarea>
<input type="submit" name="submit" value="submit" id="submitBtn" />
<input type="submit" name="clearForm" value="clear form" id="clearFormBtn" />
</p>
</div>
</form>
Code: Select all
<?php
$webmaster = "shlomi.nahari@hotmail.com";
$name = $_POST ['nameTextBox'];
$subject = $_POST ['subTextBox'];
$email = $_POST ['emailTextBox'];
$message = $_POST ['msgTextBox'];
$emailmessage = "Name: " . $name . "/n" . $message;
$headers = "From: {$email}";
mail ($webmaster, $subject, $emailmessage, $headers);
?>