# Php contact form with image verify

**URL:** <https://forum.kirupa.com/t/php-contact-form-with-image-verify/313761>\
**Category:** Uncategorized\
**Created:** [September 9, 2010, 2:58am UTC](https://forum.kirupa.com/t/php-contact-form-with-image-verify/313761 "2010-09-09T02:58:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joserinu](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@Joserinu](https://forum.kirupa.com/u/Joserinu)\
**Post date:** [September 9, 2010, 2:58am UTC](https://forum.kirupa.com/t/php-contact-form-with-image-verify/313761/1 "2010-09-09T02:58:28Z")

</div>

Hello, i cannot seem to get this working. It wouldn’t email to my server. Can anyone help me please. I would like to get this working.:q:

contact form code  
\<div id=“form”\>  
\<form action=“mailer.php” method=“post” name=“form1” id=“form1” style=“margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px; width:300px;” onsubmit=“MM\_validateForm(‘from’,’’,‘RisEmail’,‘subject’,’’,‘R’,‘verif\_box’,’’,‘R’,‘message’,’’,‘R’);return document.MM\_returnValue”\>

Your Name:\<br /\>  
\<input name=“name” type=“text” id=“name” style=“padding:2px; border:1px solid #CCCCCC; width:180px; height:14px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;” value="\<?php echo $\_GET[‘name’];?\>"/\>  
\<br /\>

Your e-mail:\<br /\>  
\<input name=“from” type=“text” id=“from” style=“padding:2px; border:1px solid #CCCCCC; width:180px; height:14px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;” value="\<?php echo $\_GET[‘from’];?\>"/\>  
\<br /\>

Subject:\<br /\>  
\<input name=“subject” type=“text” id=“subject” style=“padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;” value="\<?php echo $\_GET[‘subject’];?\>"/\>  
\<br /\>

Type verification image:\<br /\>  
\<input name=“verif\_box” type=“text” id=“verif\_box” style=“padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;”/\>  
\<img src=“verificationimage.php?\<?php echo rand(0,9999);?\>” alt=“verification image, type it in the box” width=“50” height=“24” align=“absbottom” /\>\<br /\>  
\<br /\>

\<!-- if the variable “wrong\_code” is sent from previous page then display the error field --\>  
\<?php if(isset($\_GET[‘wrong\_code’])){?\>  
\<div style=“border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;”\>Wrong verification code\</div\>\<br /\>  
\<?php ;}?\>

Message:\<br /\>  
\<textarea name=“message” cols=“6” rows=“5” id=“message” style=“padding:2px; border:1px solid #CCCCCC; width:300px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;”\>\<?php echo $\_GET[‘message’];?\>\</textarea\>  
\<noscript\>\<a href=“[http://www.thewebhelp.com](http://www.thewebhelp.com)” style=“display:none;”\>contact form by thewebhelp\</a\>\</noscript\>  
\<input name=“Submit” type=“submit” style=“margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;” value=“Send Message”/\>  
\</form\>

mailer code

\<?php  
// -----------------------------------------  
// The Web Help .com  
// -----------------------------------------  
// remember to replace [your@email.com](mailto:your@email.com) with your own email address lower in this code.

// load the variables form address bar  
$name = $\_REQUEST[“name”];  
$subject = $\_REQUEST[“subject”];  
$message = $\_REQUEST[“message”];  
$from = $\_REQUEST[“from”];  
$verif\_box = $\_REQUEST[“verif\_box”];

// remove the backslashes that normally appears when entering " or ’  
$name = stripslashes($name);  
$message = stripslashes($message);  
$subject = stripslashes($subject);  
$from = stripslashes($from);

// check to see if verificaton code was correct  
if(md5($verif\_box).‘a4xn’ == $\_COOKIE[‘tntcon’]){  
// if verification code was correct send the message and show this page  
$message = "Name: “.$name.”  
".$message;  
$message = “From: “.$from.”  
“.$message;  
mail("MYEMAIL@gmail.com”, 'Online Form: '.$subject, $\_SERVER[‘REMOTE\_ADDR’].”

“.$message, “From: $from”);  
// delete the cookie so it cannot sent again by refreshing this page  
setcookie(‘tntcon’,’’);  
} else {  
// if verification code was incorrect then return to contact page and show error  
header(“Location:”.$\_SERVER[‘HTTP\_REFERER’].”?subject=$subject&from=$from&message=$message&wrong\_code=true");  
exit;  
}  
?\>
