HTML - Captcha To My Contact Form
Hi I want to add a CAPTCHA to my contact form as i have been getting hit badly by spammers was wondering if any one could give me some advice or script on how to do that....thanks in advance
Similar TutorialsI am having a problem adding captcha to this form. I am looking at tutorials but are even more confused by them please help.
HTML Code: <head> <link rel=stylesheet href="stylesheet2004.css" type="text/css"> <script language="javascript" src="hide.js" type="text/javascript"></script> <script type="text/javascript"> <!-- function MM_validateForm() { //v4.0 if (document.getElementById){ var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } } <script language="JavaScript"> // Code for validating the form // Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml // for details var frmvalidator = new Validator("contact_form"); //remove the following two lines if you like error message box popups frmvalidator.EnableOnPageErrorDisplaySingleBox(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("email","req","Please provide your email"); frmvalidator.addValidation("email","email","Please enter a valid email address"); </script> <script language='JavaScript' type='text/javascript'> function refreshCaptcha() { var img = document.images['captchaimg']; img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000; } </script> //--> </script> <script language="javascript" src="emailvalidation.js" type="text/javascript"></script> </head> <body> width="386" height="65" border="0"></div></nobr> <table border="0" width="770" cellspacing="0" cellpadding="0" align="center"> </tr> </table> <table border="0" width="770" cellspacing="0" cellpadding="0" align="center"> <tr> <td id="navigation" valign="top" width="155"> <!-- navigation--> <script language="javascript" src="navigation.js" type="text/javascript"></script> <noscript> <div class="nav"><a href="/instruments/index.html">Products</a></div> <div class="nav"><a href="/applications/index.html">Applications Gallery</a></div> <div class="nav"><a href="/downloads.html">Product Literature</a></div> <div class="nav"><a href="/order.html">How to Order</a></div> <div class="nav"><a href="/about.html">About Mark-10</a></div> <div class="nav"><a href="/contact.html">Contact Us</a></div> <div class="nav"><a href="/faq.html">Frequent Questions</a></div> <div class="nav"><a href="/distributor.html">Distributors</a></div> <div class="nav"><a href="/tools/angle.html">Conversion Calculators</a></div> <div class="nav"><a href="/list.html">Join Mailing List</a></div> <div class="nav"><a href="/index.html">Home</a></div></noscript> <!-- end navigation--> </td> <td id="spacer" class="divid"><img src="images/spacer.gif" alt="" width="11" height="1" border="0"></td> <td id="content_table"> <h1>INQUIRIES</h1> <p>Thank you for taking an interest in Mark-10 force and torque measurement products. If you have any specific questions or an application for which you would like us to recommend a solution, please complete the appropriate fields below. If you wish to receive our latest catalog and/or be added to our mailing list, please check the appropriate boxes below.</p> <p> </p> <FORM id="frmCaptcha" NAME="frmCaptcha" METHOD="POST" action="http://www.mark-10.com/cgi-bin/mailto" style="padding:0px; margin:0px;"> <INPUT TYPE="hidden" NAME="RECIPIENT" VALUE="info@mark-10.com"> <INPUT TYPE="hidden" NAME="subject" VALUE="Mark-10 Web Submit Form"> <INPUT TYPE="hidden" NAME="THANKURL" VALUE="http://www.mark-10.com/thankyou-inquiry.html"> <input type="hidden" name="identicalfields" value="Email,Emailconfirm"> <table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="600" height="493"> <tr> <tr> <td width="131" height="22" colspan="2" align="right">*Name:</td> <td height="22" colspan="2" onfocus=><input type="text" name="Name" id="Name"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">Title:</font></td> <td colspan="2" height="22"><input name="Title" type="text" size="41"></td> </tr> <tr> <p style="width:300px; text-align:right;"> <td colspan="2" style="text-align: right"> *Email:</td> <td height="22" colspan="2" align="left"><input type="text" name="Email" id="Email"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right">*Confirm Email: </td> <td height="22" colspan="2" align="left"><input type="text" name="Emailconfirm" size="22" id="Emailconfirm"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">Company: </font></td> <td colspan="2" height="22"><input name="Company" type="text" size="41"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><p align="left" style="text-align: right; margin-top: 0; margin-bottom: 0"> Industry:</td> <td colspan="2" height="22"><input name="Industry" type="text" size="41"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">*Address:</font></td> <td colspan="2" height="22"><input name="Address1" type="text" id="Address1" size="53"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right">*<font size="2">City:</font></td> <td colspan="2" height="22"><input name="City" type="text" id="City" size="30"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">*State/Province:</font></td> <td colspan="2" height="22"><input name="State" type="text" id="State" size="30"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">*Zip / Postal Code:</font></td> <td colspan="2" height="22"><input name="Zip" type="text" id="Zip" size="30"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">Country:</font></td> <td colspan="2" height="22"><input name="Country" type="text" size="30"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">Telephone:</font></td> <td width="202" height="22"><input name="Tel" type="text" size="30"></td> <td width="247" height="22"><font size="2">Ext: </font> <input name="Ext" type="text" size="9"></td> </tr> <tr> <td width="131" height="22" colspan="2" align="right"><font size="2">Fax:</font></td> <td colspan="2" height="22"><input name="Fax" type="text" size="30"></td> </tr> <tr> <td width="131" height="75" colspan="2" align="right"><p style="text-align: right; margin-top: 0; margin-bottom: 0"><font size="2"> Application </font></p> <p style="text-align: right; margin-top: 0; margin-bottom: 0"><font size="2"> or Question:</font> <p> </td> <td colspan="2" height="75"><textarea name="Application" style="width:425px; height: 75px;" rows="1" cols="20"></textarea></td> </tr> <tr> <td width="131" height="6" colspan="2" align="right"></td> <td colspan="2" height="6"><input type="checkbox" name="SendCatalog" value="Yes"> <font size="2"> Send me your latest catalog</font></td> </tr> <tr> <td height="34" colspan="2" align="right"> </td> <td colspan="2" height="34"><input type="checkbox" name="AddToMailingList" value="Yes"> <font size="2"> Add me to your mailing list</font></td> </tr> <tr> <td height="34" colspan="2" align="right"> </td> <td colspan="2" height="34"> <img id="imgCaptcha" src="create_image.php" /> <label for="message"><br> Enter the code above here :</label> <input id="txtCaptcha" type="text" name="txtCaptcha" value="" maxlength="10" size="32" /></td> </tr> <tr> <td height="34" colspan="2" align="right"> </td> <td colspan="2" height="34"><input id="btnCaptcha" type="button" value="Captcha Test" name="btnCaptcha" onClick="MM_validateForm('Name','','R','Email','','RisEmail','Emailconfirm','','RisEmail','Address1','','R','City','','R','State','','R','Zip','','R');return document.MM_returnValue; return ErrorCheck(); getParam(document.frmCaptcha)" value="Submit"> <input type="reset" value="Clear" name="Reset"></td> </tr> </table> </form></td> </tr> </table> <br> <table cellspacing="2" width=525 border=0 celpadding="3"> </table> </FORM> </body> The contactus page currently sends data to 3 email addresses. I dont verify these fields currently but wish to do so. I merely have them sent to feedback.php which accepts the data and sends the emails. I want two things done where I need help: 1, I need all fields to be validated in the contactus page itself before going to the feedback.php file 2, I want a simple captcha that can also be verified on contactus.php itself. Can someone help? Thanks Navs We currently have a feedback form (feedback.php) that is used in our contactus page. This gets sent to three email address. I now want to add a captcha to it and create a verification for all the fields in the contactus page itself ah sorry i think this should be in php thread Hi, im trying to have a math captcha in my registration form, but having trouble with setting it up in my form. sorry for the large code. If i change the value of $_POST['Submit'] to something else like $_POST['Submit1'] and then same for the math image captcha then it works, but i would like it to work as part of the form, makes sense? lol right now the form just posts the value and doesnt check for captcha values! if someone could help me out here that would be great! thank you. <?php if(isset($_POST['Submit'])){ if($_POST['Submit'] != $_SESSION['security_number']) { $error = ""; } else { $error = ""; } //NEED TO CHECK IF FIELDS ARE FILLED IN if( empty($_POST['name']) && (empty($_POST['email']))){ header("Location:Messages.php?msg=3"); exit(); } if( empty($_POST['pw1']) && (empty($_POST['pw2']))){ header( "Location:Messages.php?msg=4" ); exit(); } $name=$_POST['name']; $email=$_POST['email']; $pw1=$_POST['pw1']; $pw2=$_POST['pw2']; if("$pw1" !== "$pw2" ){ header( "Location:Messages.php?msg=5" ); exit(); } $ip = $_SERVER['REMOTE_ADDR']; //connect to the db server , check if uname exist include('config.php'); $query1=("Select * from user where email='$email'"); $result1= mysql_query($query1); $num1=mysql_num_rows($result1); if ($num1 > 0) {//Email already been used header( "Location:Messages.php?msg=11" ); exit(); }else{ $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); if ($num > 0) {//Username already exist header( "Location:Messages.php?msg=6" ); exit(); }else{ //if username does not exist insert user details $query=( "INSERT INTO user (uname, pw,email,date_joined,ip,level) VALUES ('$name',md5('$pw1'),'$email',NOW(),'$ip','Normal')"); if (@mysql_query ($query)) { header("location:login.php?reg=1"); exit; } } } mysql_close(); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><!-- InstanceBegin template="/Templates/Auth.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Registration</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="styleLog.css" rel="stylesheet" type="text/css"> <script language="javascript" type="text/javascript"> function reloadCaptcha() { document.getElementById('captcha').src = document.getElementById('captcha').src+ '?' +new Date(); } </script> </head> <body> <table width="100%" border="0" cellspacing="7" cellpadding="0"> <tr class="temptitle"> <td><!-- InstanceBeginEditable name="EditRegion4" -->New User Registration <!-- InstanceEndEditable --></td> </tr> <tr> <td><!-- InstanceBeginEditable name="EditRegion3" --> <form name="form1" action="register.php" method="post"> <table width="657" border="0"> <tr> <td width="122"><div align="left">Name</div></td> <td width="525"><input name="name" type="text" size="40"></td> </tr> <tr> <td><div align="left">Email</div></td> <td><input name="email" type="text" size="40"></td> </tr> <tr> <td><div align="left">Password</div></td> <td><input name="pw1" type="password" size="40"></td> </tr> <tr> <td ><div align="left">Confirm Password </div></td> <td><input name="pw2" type="password" size="40"></td> </tr> <tr> <td><img src="math_captcha/image.php" alt="Click to reload image" title="Click to reload image" id="captcha" onclick="javascript:reloadCaptcha()" /></td> <td><input type="text" name="Submit" value="what's the result?" onclick="this.value=''" /></td> <td> </tr> <tr> <td></td> <td> <input name="Submit" type="submit" value="Register"></td> </tr> </table> </form> <?=$error?> is there something wrong with this code im not recieving emails <form name=contactme action=contactme.php method=post> <div align="center"> <table> <tr> <td align=right>Name:</td> <td width="15"> </td> <td><input size=45 maxlength=45 type=text name=name style="font-family: Courier New; font-size: 10pt"></td></tr> <tr> <td align=right>Email:</td> <td> </td> <td><input size=45 maxlength=45 type=text name=from style="font-family: Courier New; font-size: 10pt"></td></tr> <tr> <td align=right>Subject:</td> <td> </td> <td><input size=45 maxlength=90 type=text name=subject style="font-family: Courier New; font-size: 10pt"></td></tr> <tr> <td valign=top align=right>Contents:</td> <td> </td> <td><textarea name=body rows=12 cols=60 style="font-family: Courier New; font-size: 10pt"></textarea></td></tr> <tr> <td> </td> <td> </td> <td><input type=submit value=" Submit " name=submit style="font-size: 10pt; font-family: Tahoma"></td></tr> </table> </div> </form> Hello guru's, I have created a contact form on the website, but i dont know how to send the information that the users has typed to my email address What code do i need to type? Hello, I am working on a contact page and was wondering if someone could help me with the following. I have created my form in html already with minor look changes in css (nothing big). I would like to write a javascript that will first validate the manditory fields (Name, email, and the message) after which it will compile all entered data into a popup/new page that JUST shows the information to be copy and pasted to an email; then later sent off. For example if someone enters their name, email, location and message, the javascript will accept the form due to all the mandatory fields being present, and then depending on what the user input in the input fields, it will output something like the following on a new page or window: COPY AND PASTE BELOW THIS LINE --------------------------------------------------- Name: So and So Email: name@email.com Location: Country Message: Message is whatever length. --------------------------------------------------- I do have basic java knowledge so im not a total newbie. Thank you for all help; hope this isnt too daunting a task for you all. Just a little insight needed. Thanks again, -Alim Not sure if this is the right place but I was just wondering if anyone could help me. I'm trying to make an option on my contact form that when you click it, it affects whether you have to enter the other fields or drop-down box. For example and simply put, if someone clicked the box labeled 'red', then it would be required for them to fill out the box that says 'explain your choice'. However if they do not click red, then they do not need to fill out the 'explain your choice' box... How do I do this? Is there a name for it? Thanks for any help I would like someone to help me get the email form on the html page working. I am so lost! http://hershs-salsa.com/locations.html Hi guys, i'm here with another question, I need to make a contact form for my website, I posted this at html section but i'm not sure, some people say it's html, some php some say it's both... So I googled a bit and all I find are things like this: Code: <form method="post" action="mailto:youremail@email.com"> <textarea rows="5" cols="20" wrap="physical" name="comments"> Enter Comments Here </textarea> <input type="submit" value="Send Email"> </form> This just opens windows live mail..I want to people just click a button "send email" and it sends to my email, nothing more...not this confusions...i've been googling and I find nothing, so I want to talk to the experts, which are you guys I'm new to this so I'm going to post the template I found and then hopefully someone can make it right. Will upload two text files first is the contact page its an html file. the other is the contact script as a php file. Sorry if this has been brought up before but i've been trying now for about 6 hours. Thank you Bill Ruiter I want to be able to have three boxes that a visitor can enter input and it be emailed to me. For example: Name - (Visitor types in name) Email - (Visitor types in email) Question - (Visitor types in question) Than they hit Submit and it is emailed to me. I have found code that uses Outlook to do it, but I want it to do it through the website. Can someone please let me know where I can find a free contact form for my site. All I want is a simple form - eg: Name: Email: Message: Send: If possible a form that I can copy and paste right onto my site, thanks! I'm trying to create a form for my website that will email me the information when submitted. I don't know if this can be done in HTML. I cant use PHP on my forum so it cant be that. The other option i have is one coded in JavaScript. Anyone know where i can either get a html or JavaScript code for such a thing please. Thanks Jake Alright, i'm having a problem with this contact form. I made it so that it will send to your email. But when I submit, its supposed to say on a new page "Your message has been sent.", but when I send it, all it says is "'); header('Location: sent.html'); ?>". Here is the codes: Code: <html> <head> <title>Contact</title> </head> <body> <form action="form.php" method="post"> Name<br/><input type="text" name="name" /><br/> Email<br/><input type="text" name="email"/><br/> Message<br><textarea row="7" cols="70" name="message"></textarea><br/> <input type="submit" value="Submit" /> </form> </body> </html> Code: <?php $name = $_POST['name']; $email = $_POST['email']; $text = $_POST['mesasge']; mail('EMAILHERE', 'message, $text, 'From: ' . $name . ' <' . $email . '>'); header('Location: sent.html'); ?> Code: <html> <head> <title>Sent</title> </head> <body> Your message has been sent. </body> </html> Help will be appreciated. Thanks for your time. For my website i want to create a table/form where people can fill in thier email, a comment and it sends it to my emai without them actualy knowing my email addressl, any idea how i can do this? Many Thanks, Narc Hello everyone, I know this might sound easy but I can't remember how to do this. Does anyone know how to send information from a simple form by hitting the submit button and I should be able to view the data in my domain email? I guess you can say I can check my email and the name, email and message form fields would displayed. I've created the form, form fields and the buttons in dreamweaver. I'm not sure if the enctype is ="multipart/form-data" I've done this before in front page. it come out as a web bot but i cant remember how this works in dreamweaver. I hope I haven't confused anyone. Please reply if you know what I'm talking about. Thank you. Here is the code below from my contact.html page: <form action="thankyou.asp" method="post" enctype="text/plain" name="contactform" target="_blank"> <span class="formstitle">Name:</span><br> <input name="textfield" type="text" class="formstitle2" size="30" maxlength="30"> <br> <br> <span class="formstitle">Email:</span><br> <input class="formstitle2" name="email" type="text" id="email" size="30" maxlength="30"> <br> <br> <span class="formstitle">Message:</span><br> <textarea name="message" cols="30" rows="4" class="formstitle2" id="message"></textarea> <br> <br> <input name="Submit" type="image" value="Submit" src="images/submit.gif" alt="submit" width="56" height="28"> <input type="image" src="images/clear.gif" alt="clear" width="56" height="28"> <br> </form> Hi, I'm working on a contact form and its almost finished. There are 2 main offices the form can go to. for example UK office and France office. I want to add 2 check boxes or radio boxes so that the person filling out the form can choose which office they want the form to go to. Is this possible and if so anyone got exampel code i can use to add to my form and mail.php script? Hi, Lookign for a good soruce for a contact/support form. I have a simple contact form but now i want to add some validation checks. If any has a form already that they would happily share or knows where i can get a form similar to the below please let me know. My contact form needs to have: Name (required) Email (validation check) phone (required) Comments (just a text area) how did you here about us? check boxes to include search engine (with a text box to put name) advert flyer friend/colleague other (with a text box to fill in) submit and reset The support form needs to be: name (required) web address (required) email (validation check) phone (required) comments (just a text area) checkbox to accept terms and conditions (required) (terms and conditions to be stored in a scrollable text area which cant be edited but can be read) submit and reset If anyone can point me at a source to get most of this already done then it will save me alot of time. CC_DESIGN Hello every1 i need to create a contact us or an Email us form thing to put in my website i googled it and got all these generators but non of them work so peeps all i need is to make a form in HTML language to insert in the middle of my page that wud have 4 boxes and 2 buttons BOXES: 1 - Name : (Single Line Field) 2 - E-Mail: (Single Line Field, E-Mail Field) 3 - Subject: (Signle Line Field) 4 - Message: (Multi-Line Field) the e-mail field should check the email format i dont know i saw it in one of the generators but i didnt really know how to do it now the BUTTONS: 1 - Submit ( To send the mail to my e-mail ) 2 - Clear Fields ( to clear all the fields ) now i want when i click on submit to mail me the information using the subject field as the email subject and mail it to this email for example : email@domain.com and then redirect the browser to a page thats called /thanku.htm for example and if yall dont mind me askin another question how to creat a timer for a page? like for example i want to set a timer in this /thanku.htm page that it will count 5 seconds after opening it and then redirect again to to /index.htm for example thank u very much i really need this BYE i bought this template and going well, but i am stuck with the contact page, i want the user to be able to fill the contact form and send it to my mailbox.. yes i have tried it myself and also build my own contact.php . But the template coding is a bit confusing for me Code: <div id="content"> <div class="bg-cont png"> <div class="indent-main"> <div class="container"> <div class="col-1"> <div class="box"> <form action="" id="form2"> <div class="indent-box"> <img alt="" src="images/6page_title1.gif" class="title1" /><br /> <div class="h1"><input type="text" class="input1" value="Name: " /></div> <div class="h1"><input type="text" class="input1" value="E-Mail: " /></div> <div class="h1"><input type="text" class="input1" value="Phone:" /></div> <div class="h1"><input type="text" class="input1" value="State:" /></div> <textarea rows="40" class="textarea" cols="30" value="Message:">Message:</textarea><br /> <div class="fright"> <a href="#" class="link-1" onclick="document.getElementById('form2').reset()"><em><b>Reset</b></em></a> <div class="indent-2"><a href="#" class="link-1" onclick="document.getElementById('form2').submit()"><em><b>Send</b></em></a></div> </div> <div class="clear"></div> </div> </form> </div> so lets say i make a contact.php and i will change it to <form action="contact.php" id="form2"> how about this line: what should i replace with "a href?????? " Code: <div class="fright"> <a href="#" class="link-1" onclick="document.getElementById('form2').reset()"><em><b>Reset</b></em></a> <div class="indent-2"><a href="#" class="link-1" onclick="document.getElementById('form2').submit()"><em><b>Send</b></em></a></div> and here is my contact.php page... it doesn't work properly Code: <?php $name = $_POST['Name']; $email = $_POST['E-Mail']; $phone = $_POST['Phone']; $state = $_POST['State']; $Message = $_POST['Message']; $to = "gilbylu@gmail.com"; $subject; $message = ""; foreach($_POST as $key=>$value) { $message .= $key.": ".$value."\n\r"; } mail($to,$subject,$message); ?> <html> <head> <title> Contact - Message Sent</title> <body> Message Sent Succesfully. </body> </html> |