rlgriffo
07-14-2008, 12:16 PM
Hi I have nearly been driven mad by this, i have NO idea why it keeps giving me the "oh no" (error message)...if someone could point me in the right direction I would REALLY appreciate it!!
__________________________________________________ _____________
PHP
__________________________________________________ _____________
<?php
if(isset($_POST['submit'])) {
$to = "info@aussiewebsites.net";
$subject = "mailform";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$location_field = $_POST['location'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message Location: $location_field\n";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "Oh NO!";
}
?>
__________________________________________________ _____________
HTML
__________________________________________________ _____________
<form method="post" action="mailer.php">
<input type="hidden" name="sub" value="1">
<td valign="top"><table border="0" cellpadding="5" cellspacing="20">
<tr>
<td align="left" valign="top">
<label for="name">Name: </label>
<input name="name" type="text" id="name" size="40" class="search {required:true}"/>
<br />
<label for="phone">Phone: </label>
<input name="phone" type="text" id="phone" size="40" class="search {required:true}"/>
<br />
<label for="email">Email: </label>
<input name="email" type="text" id="email" size="40"class="search {required:true}"/>
<br />
<label for="location">Location: </label>
<input name="location" type="text" id="location" size="40"class="search {required:true}"/>
<br />
<br />
<label for="message">Message: </label>
<br />
<textarea name="message" cols="40" rows="4" id="message" class="message {required:true}"></textarea>
</p>
<p><br />
<input type="submit" value="submit" columns=50 id="submit">
</p></td>
</tr>
</table>
</td>
</form>
__________________________________________________ _____________
PHP
__________________________________________________ _____________
<?php
if(isset($_POST['submit'])) {
$to = "info@aussiewebsites.net";
$subject = "mailform";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$location_field = $_POST['location'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message Location: $location_field\n";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "Oh NO!";
}
?>
__________________________________________________ _____________
HTML
__________________________________________________ _____________
<form method="post" action="mailer.php">
<input type="hidden" name="sub" value="1">
<td valign="top"><table border="0" cellpadding="5" cellspacing="20">
<tr>
<td align="left" valign="top">
<label for="name">Name: </label>
<input name="name" type="text" id="name" size="40" class="search {required:true}"/>
<br />
<label for="phone">Phone: </label>
<input name="phone" type="text" id="phone" size="40" class="search {required:true}"/>
<br />
<label for="email">Email: </label>
<input name="email" type="text" id="email" size="40"class="search {required:true}"/>
<br />
<label for="location">Location: </label>
<input name="location" type="text" id="location" size="40"class="search {required:true}"/>
<br />
<br />
<label for="message">Message: </label>
<br />
<textarea name="message" cols="40" rows="4" id="message" class="message {required:true}"></textarea>
</p>
<p><br />
<input type="submit" value="submit" columns=50 id="submit">
</p></td>
</tr>
</table>
</td>
</form>