Jump to content

beelzebomb

New Members
  • Posts

    1
  • Joined

  • Last visited

beelzebomb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have this nicely working form code for my website, but want to add my own simple captcha. I want to add another field that forces users to type out what they see in a static image that I will insert - so there is only one right answer. If, for example, name required the word 'stan' to be added, how do I force users to do this? Many thanks in advance! <?php if(isset($_POST['submit'])) { $name = $_POST['name']; // required $telephone_number = $_POST['telephonenumber']; // required if($name=='' || $telephone_number=='' ) { die('You have not filled in all of the required fields - please hit your back button and try again!'); } else{ $email_to = "my@email.com"; $email_subject = "Contact from company"; $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($name)."\n"; $email_message .= "Telephone Number: ".clean_string($telephone_number)."\n"; // create email headers $headers = 'From: Company'. //'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.