PDA

Click to See Complete Forum and Search --> : I need help, this web form is driving me insane


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>

Benjamin
07-14-2008, 12:38 PM
Try adding 'name="submit"' to your input element?

Drazan
07-14-2008, 12:40 PM
Never use an open form like that without any "processing" to strip out HTML hacks/injections and spammers. As well as Captcha to block bots from using your open code as a spam server.

try this instead
http://www.dagondesign.com/articles/secure-php-form-mailer-script/

Jade

rlgriffo
07-15-2008, 01:58 AM
Hi, thank you both for the reply,

I did use that suggestion you made Jade and it works great for the contact form, however i am really needing to know how to get a html webform with a php back submitting properly as I have another form which is much larger (with colour pickers etc) that I am making but i need to know how to get the damn thing sending.

The form you told me about doesnt seem to have any html in it?

Or am i wrong.

Thanks again, i do really appreciate your time.

rlgriffo
07-15-2008, 02:07 AM
Benjamin


YOU ARE MY HERO!!!!!!!!!!!!!!!!

THANK YOU SO MUCH!!