INeedAGig Posted April 8, 2011 Share Posted April 8, 2011 Okay, minor issue, but not sure how to resolve. I have a form that processes through PHP and has it's fields validated with JS and sends the data to an e-mail address and a database. It works fine, but there are random times where a submitted entry will show up blank in the e-mail and not be in the database at all, any ideas on what might be causing this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/233123-blank-at-random/ Share on other sites More sharing options...
INeedAGig Posted April 8, 2011 Author Share Posted April 8, 2011 Nevermind, I narrowed it down, its the Javascript validation. If it is turned off in the browser, the user can hit the submit button and bypass the validation and thus, it returns a blank form. One question though, is there any type of PHP validation anyone can recommend? That way I don't have to worry about the validation having a back door.... Quote Link to comment https://forums.phpfreaks.com/topic/233123-blank-at-random/#findComment-1198923 Share on other sites More sharing options...
Pikachu2000 Posted April 8, 2011 Share Posted April 8, 2011 Javascript is not validation. As you just saw, all anyone has to do is disable javascript, or in the case of most spambots, not use it all, and the JS 'validation' is useless. You must validate all user input server-side. Quote Link to comment https://forums.phpfreaks.com/topic/233123-blank-at-random/#findComment-1198980 Share on other sites More sharing options...
dcro2 Posted April 8, 2011 Share Posted April 8, 2011 http://lmgtfy.com/?q=php+form+validation Or if you need something specific, maybe you could tell us what that is. Quote Link to comment https://forums.phpfreaks.com/topic/233123-blank-at-random/#findComment-1198999 Share on other sites More sharing options...
spiderwell Posted April 8, 2011 Share Posted April 8, 2011 yeah I have always used server side validation for exactly this reason! Quote Link to comment https://forums.phpfreaks.com/topic/233123-blank-at-random/#findComment-1199009 Share on other sites More sharing options...
dcro2 Posted April 8, 2011 Share Posted April 8, 2011 It can be useful in addition to PHP validation though, since it's quicker for the user not to have to load another page. Quote Link to comment https://forums.phpfreaks.com/topic/233123-blank-at-random/#findComment-1199010 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.