Nodral Posted June 20, 2011 Share Posted June 20, 2011 Hi I have a form which requires 5 values prior to submission. I need to run an isset to establish whether all the fields are complete, which I can do. I also need to run an !isset to establish if none of the fields are complete, which again I can do. However, how do I establish whether only some of the fields are complete to return a message that there is missing information from the form? Quote Link to comment https://forums.phpfreaks.com/topic/239900-isset/ Share on other sites More sharing options...
Pikachu2000 Posted June 20, 2011 Share Posted June 20, 2011 isset will return TRUE for a form field that contains an empty string, so you won't get the results you're expecting if you use it. You'd be much better off trimming the data from the incoming fields, and making sure they meet certain minimum and max length criteria with strlen, or that the values are within a specified range if applicable. Store validation errors in an array, then if the array isn't empty display the errors to the user along with the pre-populated form for corrections to be made. Quote Link to comment https://forums.phpfreaks.com/topic/239900-isset/#findComment-1232293 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.