Vortexted Posted March 25, 2008 Share Posted March 25, 2008 Hello PHP Freaks, I was searching forums to find previous entries of form checking/validation (example: ensuring all form fields are filed out before an email is sent) -------> and if a field is NOT filled in it simply creates a window message to tell the person information is missing AND/OR directly ON THE FORM it points out which fields needs required information. Side note: Script is already working (just goes back to the form fill out page without a warning message). However, I find the old script a programmer did ages ago not very functional -- > (snippet for checking fields) if ($check) { $check = check_str($street); if (!$check) $errors = "7"; } if ($check) { $check = check_str($city); if (!$check) $errors = "8"; } Is long and will get longer as I add more additional field checking which I'd like to change (btw, I have no clue why such error checking was done, it's like every check on every field creates an if statement that goes up in number "8" to "9" and "10" etc etc. Also, if any form fields are not filled out it CURRENTLY just reverts back to an order page without a warning message. It works, but done nasty. (script snippet for example) if (!$check) { ?> <script>location.href="order.phtml?email=<?=$email?>&last_name=<?=$last_name?>&first_name=<?=$first_name?>&street=<?=$street?>&city=<?=$city?>&state_id=<?=$state_id?> if (isset($ship_info)) { ?>&ship_info=<?=$ship_info?><? } if ($debug) { ?>&error=<?=$errors?><? } ?>";</script> <? } else { then the actual email form occurs and everything processes accordingly. I'm pretty good and looking at prior examples. If anyone knows of where to find direct links in the forums to previous form validation and putting "window messages" or messages that tell a person which fields need to be filled out directly onto a form --- > that would be great and I can work my head around it with prior code help so I can change the entire form validation to increase functionality. Many thanks for any direction to other links/support or help. Shannon aka Vortexted Quote Link to comment https://forums.phpfreaks.com/topic/97861-form-checking-validation/ Share on other sites More sharing options...
laffin Posted March 25, 2008 Share Posted March 25, 2008 I provided a simple example in another thread Form Validation Quote Link to comment https://forums.phpfreaks.com/topic/97861-form-checking-validation/#findComment-500755 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.