john8m Posted February 14, 2008 Share Posted February 14, 2008 I want to be able to prevent my simple contact form from being processed if a "hidden" field has been filled in (to prevent spam). I'm going to hide the field with css so human users don't fill it in. I've searched and searched for this with no luck! (new to php by the way) Thanks in advance Link to comment https://forums.phpfreaks.com/topic/91108-how-do-i-stop-a-contact-form-being-processed-if-a-condition-applies/ Share on other sites More sharing options...
Isityou Posted February 14, 2008 Share Posted February 14, 2008 Use javascript to validate the form than act based on javascripts results. Link to comment https://forums.phpfreaks.com/topic/91108-how-do-i-stop-a-contact-form-being-processed-if-a-condition-applies/#findComment-466939 Share on other sites More sharing options...
Psycho Posted February 14, 2008 Share Posted February 14, 2008 <?php if ($_POST['hidden_field']!='') { //do not process form } else { //process form } ?> Link to comment https://forums.phpfreaks.com/topic/91108-how-do-i-stop-a-contact-form-being-processed-if-a-condition-applies/#findComment-466941 Share on other sites More sharing options...
haku Posted February 14, 2008 Share Posted February 14, 2008 Use javascript to validate the form than act based on javascripts results. Not reliable - easily circumvented by turning off javascript. Program your PHP check, then add javascript overtop to improve functionality for the user. Link to comment https://forums.phpfreaks.com/topic/91108-how-do-i-stop-a-contact-form-being-processed-if-a-condition-applies/#findComment-466950 Share on other sites More sharing options...
john8m Posted February 14, 2008 Author Share Posted February 14, 2008 Thanks mjdamato That worked a treat. Link to comment https://forums.phpfreaks.com/topic/91108-how-do-i-stop-a-contact-form-being-processed-if-a-condition-applies/#findComment-467005 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.