PHP cnotact form/script

Hello everyone i have a small PHP contact script that I use for sites and am now starting to see an issue with it. The scrip work and gets information sent by the user to the designated target, however, it appears that the clients keep getting multiple blank forms a day from the script. Im sure that I just wrote these poorly or something so any advice would be greatly appreciated :slight_smile: here are my scripts:


$to = “*************” ;
$from = $_REQUEST[‘name’] ;
$email = $_REQUEST[‘email’] ;
$tel = $_REQUEST[‘tel’] ;
$message = $_REQUEST[‘message’] ;
$headers = “From: $from”;
$subject = “Online Contact Form”;

$fields = array();
$fields{“name”} = “Customer Name”;
$fields{“email”} = “Email Address”;
$fields{“tel”} = “Telephone Number”;
$fields{“message”} = “Message”;

$body = “We have received the following information:\n\n”; foreach($fields as $a => $b)
{ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

 $send = mail($to, $subject, $body, $headers);

header( “Location: http://www.*************.com” );

?> [/php]



Name :

Email :

Telephone :

Message :

Keep In Touch:

					<li class = "white">Tel:</li>
					<li class = "tan">803-464-5779</li>
					<li class = "white">Email:</li>
					<li class = "tan">[email protected]</li>
                <ul id="sm-links">
                	<li><a href="" class="facebook" target = "_blank" >Facebook</a></li>
		<div class="bottom-divider"></div>

It could be from bots. You can add a captcha, add javascript validation on the form, and add php validation to check for empty values.

Sponsor our Newsletter | Privacy Policy | Terms of Service