View Full Version : mail contact form
08-19-2005, 10:39 AM
I hve a problem with my email form, it works every time I test it but I keep getting blanks through from my website. As if someone has tried to email me but not filled the form in (I know, I need to put validation on) I dont know if I'm missing people trying to contact me or if something is going wrong. I know someone from this forum submitted the contact form yesterday but it came through blank and I dont know if it was really blank or not.
Has anyone ever experienced this?
08-19-2005, 10:56 AM
We have a lot of clients with these forms and we used to get blank ones through all the time before I implemented some basic validation. Sometimes people click the button by mistake or maybe they get triggered by bots, sometimes it might even be a malicious user looking for vulnerabilities in a form, who knows, I gave up trying to figure it out a long time ago :p
You generally only need to put validation on one field to filter these out, something as simple as:
$_POST['name'] = (isset($_POST['name']) ? trim($_POST['name']) : ''); // we'll do a basic test on the user's name
exit('You did not enter your name. Please click back in your browser and try again.');
I use a similar system for my validation and couple it with sessions to send back the post data and populate the form so the user doesn't have to re-enter their data each time, just the fields that need attention and it's cleared up the problem of ghost forms completely.
08-19-2005, 12:37 PM
Glad its not just me then. For clients I always put validation on but I didnt bother on this one cos its just for me, one of those things on the ever increasing 'to do' list of my life lol ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.