homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

[?] Whats wrong with this php form :'(
I really don't know why doesn't work

 5:16 pm on Oct 3, 2009 (gmt 0)

this is my contact form. but when i click send an ERROR happen :(

index.php source:

<form action="mail.php" method="post">
name <input type="text" name="name" size="40">
family <input type="text" name="family" size="40">
phone <input type="text" name="phone" size="40">
address <input type="text" name="address" size="40">
<input type="submit" value="send">

mail.php source:

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'To: '.$to . "\r\n";
$headers .= 'From: '.$from . "\r\n";
$headers .= 'Reply-To: '.$from . "\r\n";
$sendmail=mail($to, $subject, $name, $family, $phone, $address, $headers);
if ($sendmail)
echo "sent";
echo "failed";

please correct it and place here. thank you very much



 5:29 pm on Oct 3, 2009 (gmt 0)

You should be compiling your message, because you have too many parameters in your mail()...

$sendmail=mail($to, $subject, $message, $headers);

On another note, it's scary you're not checking your POST variables for security purposes...

Here's one thread on how to do it with some different examples:

I highly recommend you check all POSTed data with a regular expression.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved