trippin13 Posted March 9, 2006 Share Posted March 9, 2006 Hi I have a form with over 200 fields .... is there a way to automate or skip theISSET() to avoid getting undefined variables??? there is too many to write there must be a better way ????please help ?? Quote Link to comment https://forums.phpfreaks.com/topic/4571-isset-issues/ Share on other sites More sharing options...
Flinch Posted March 10, 2006 Share Posted March 10, 2006 Depends on what kinds of fields they are, but if they're simple fields like text inputs, I would name the fields like "input1", "input2", "input3" and so. The, us for() to loop through every field and validate it.[code]for($i=1; $i <= 200; $i++) { //validation code here $field = "input".$i; if(! isset($_POST[$field]) ) { //empty! }}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4571-isset-issues/#findComment-15967 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.