bsamson Posted December 4, 2006 Share Posted December 4, 2006 I have a form w/ 7 mandatory fields:First Name, Last Name, City, Zip Code, Username, Password, and lastly AliasWhat is the most efficient way to check for values of all those fields and redirect back if any are found to be empty ... The following is the way I have been doing this:[code]<?phpif (empty($fname)) { header( ... } elseif { (empty($fname)) { header( ... // ETC ... ETC ...?>[/code]Any suggestions?? ... Thanks! Quote Link to comment Share on other sites More sharing options...
btherl Posted December 4, 2006 Share Posted December 4, 2006 I would make a variable (string or array), so you can collect ALL missing fields in one go. Just use a seperate "if" for each.Then after the checks, check if there are any messages, and if so, redirect and pass along the message to be displayed. You can do it with eg [code=php:0]header("Location: http://site.com/script.php?msg=" . urlencode($msg));[/code] Quote Link to comment 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.