Jump to content

Recommended Posts

I have a basic question for anyone that can help me.

Ive added a captcha input field to the form below, as Im having problems with spam appearing on my testimonial page.

 

1) How can I prevent the form from being sent if the wrong or no answer is in the form field.

2) How can i have a message appear saying "Sorry wrong answer" if the from isnt sent for the above reason?

 

add.php

<form method="post" action="process2.php" >
<textarea rows="25" cols="100" wrap="physical" name="data">
</textarea>
<input type="hidden" name="area" value="testimonial"/> 
What is 5+5?
<input type="text" name="captcha"/>
<input type="submit" value="Add ">
</form>

 

process2.php

<p class="add">Thankyou for submitting your testimonial;</br>
<?php $data="<br><br>" . $_POST["data"]; ?><br />
<?php $area=$_POST["area"]; ?>
<?php echo $data; ?></p>

<?php mysql_query("UPDATE wheelchairwizard SET data = CONCAT(data, '$data') WHERE area = '$area'"); ?>

</br>
Return to the testimonial page - <a href="http://www.wheelchairwizard.co.uk/testimonials.php">click here</a>

Link to comment
https://forums.phpfreaks.com/topic/257648-adding-a-captcha-to-a-basic-form/
Share on other sites

following up on smearny... Google around for math captcha and you will find a full code that randomizes that process into numbers and text.

 

I haven't gotten a single piece of spam on a form I implemented with that in 3 years.

 

Theres also a nifty picture puzzle captcha that works quite well also and is probably easier to implement called key captcha .

I'm not going to tell you to give up on making your CAPTCHA system, but I will suggest that you make use of a system that's already stable... and FREE

http://www.google.com/recaptcha

 

If you're looking for a not-so-difficult version, then check these out

http://woork.blogspot.com/2009/02/10-free-captcha-scripts-and-services.html

 

 

To put it short, there's no point re-inventing the wheel unless that wheel is revolutionary.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.