View Single Post
  #12 (permalink)  
Old 06-20-09, 11:25 AM
bally123 bally123 is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
I dont quite get how to use honeypots I tried but kept getting script error...

This is my original code for the form
HTML Code:
<script language="JavaScript" type="text/javascript"> 
function checkform ( form ) 
{ 
if (form.fname.value == "") { 
alert( "Please enter your full name"); 
form.fname.focus(); 
return false ;
}
if(form.femail.value.match(/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/) == null){
alert( "Please enter valid email address\nThis will only be used to reply to your enquiry." ); 
form.femail.focus(); 
return false ; 
}
if(form.fnumber.value.match(/^\d+/) == null) { 
alert( "Please enter valid contact number\nThis will only be used to contact you in regards to your enquiry." ); 
form.fnumber.focus();
return false ; 
}
if (form.subject.value == "") { 
alert( "Please enter the subject of your enquiry." ); 
form.subject.focus(); 
return false ; 
}  
if (form.fmess.value == "") { 
alert( "You must enter your enquiry"); 
form.fmess.focus(); 
return false ; 
} 
return true ; 
} 
</script> 


<script>document.writeln('<form name="form1" method="post" onSubmit="return checkform(this);" action="mailform.php">');</script>
 
 
<table width="261" border="0" cellspacing="0" cellpadding="2" align="center">
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">Your Name*<br><input name="fname" type="text" size="40"></font></td>
      </tr>
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">Your E-mail Address*<br><input name="femail" type="text" size="40"></font></td>
  </tr>
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">Address Line 1<br><input name="fadd1" type="text" size="40"></font></td>
  </tr>
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">Address Line 2<br><input name="fadd2" type="text" size="40"></font></td>
  </tr>
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">City<br><input name="fcity" type="text" size="40"></font></td>
  </tr>
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">Postal Code<br><input name="fpost" type="text" size="8" maxlength="8"> e.g. AB1C 2DE</font></td>
  </tr>
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">Contact number*<br><input name="fnumber" type="text" size="15" maxlength="15"> e.g. 0115 123 1234</font></td>
  </tr>
  <tr>
    <td width="257" ><font face="Verdana" size="1" colour="#444444">Subject*<br><input name="subject" type="text" size="40"></font></td>
  </tr>
  <tr>
    <td width="257" ><font face="Verdana" size"1" colour="#444444">Message*<br>
    <textarea name="fmess" cols="35" style="height: 66px"></textarea></font></td>
  </tr>
 
     <td width="257">
 
	 <font face="Verdana" size="1" colour="#444444">
	 <input name="cmdSend" onMouseover="return hidestatus()" type="submit" value="Send">
	 <input name="cmdReset" type="reset" value="Reset"> </font>
	</td>
  </tr>
</form>
	<tr>
     <td class="style15">
	 <font face="Verdana" size="1">* These fields are required</td>
  </tr>
</table>
Any suggestions? TIA
Reply With Quote