It is always telling me "Please specify email" even if I fill up all the input boxes, I am not really sure how to debug it so I really need help in looking as to the reason why isset($_GET['empty_email']) is failing, this has been working on another host some years ago and I just uploaded it to a new host and it is not working.
Code:<?php if(isset($_GET['empty_email'])) { ?>Please specify email.<br /> <?php } if(isset($_GET['invalid_email'])) { ?>Incorrect email format.<br /> <?php } if(isset($_GET['empty_captcha'])){ ?>Please specify verification code.<br /> <?php } if(isset($_GET['wrong_code'])){ ?>Wrong verification code.<br /> <?php } if(isset($_GET['success'])){ ?>Comment successfully sent.<br /> <?php } ?> <form action="send_contact.php" method="post"> <fieldset style="border: none;"> <input type="hidden" name="submit" value="submit" /> <p>Name:<br /> <input type="text" maxlength="50" name="name" value="" /></p> <p>Email:<br /> <input type="text" maxlength="50" name="email" value="" /></p> <p>Type verification image:<br /> <input name="verif_box" type="text" id="verif_box" /> <img src="verificationimage.php?%3C?php%20echo%20rand(0,9999);?%3E" alt="verification image, type it in the box" width="50" height="24" align="bottom" /><br /></p> <p>Comments:<br /> <textarea name="comments" rows="7" cols="7" style="width: 98%;"> </textarea></p> <p><input type="submit" name="submit" value="Submit" /></p> </fieldset> </form>
Code:<?php // Contact subject $subject ="comment"; // Details $message="$comments"; // Mail of sender $mail_from="$email"; $validationOK=true; if (Trim($mail_from)=="") $validationOK=false; if (!$validationOK) { // header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&empty_email=true"); header("Location: contact.php?subject={$subject}&from={$from}&message={$message}&empty_email=true"); exit; } if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $mail_from)) { // echo "Valid email address."; } else { header("Location: contact.php?subject={$subject}&from={$from}&message={$message}&invalid_email=true"); exit; } // captcha $captcha="$verif_box"; if (Trim($captcha)=="") $validationOK=false; if (!$validationOK) { //header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&empty_captcha=true"); header("Location: contact.php?subject={$subject}&from={$from}&message={$message}&empty_captcha=true"); //print "<meta http-equiv=\"refresh\" content=\"0;URL=contactblankcaptcha.php\">"; exit; } $verif_box = $_REQUEST["verif_box"]; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='[email protected]'; if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ $send_contact=mail($to,$subject,$message,$header); // 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"); header("Location: contact.php?subject={$subject}&from={$from}&message={$message}&wrong_code=true"); exit; } // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ //print "<meta http-equiv=\"refresh\" content=\"0;URL=contactsuccess.php\">"; // header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&success=true"); header("Location: contact.php?subject={$subject}&from={$from}&message={$message}&success=true"); } else { echo "ERROR"; } ?>




Reply With Quote