Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too many ifs?

Status
Not open for further replies.

patrickstrijdonck

Programmer
Jan 18, 2009
97
0
0
NL
Hi all,

In PHP im running a code wich questions alot of ifs,


Code:
if (trim($_POST['adres']) == "") {

offcourse I will end the if with
Code:
 }

with 6 IF rules, the page will work perfectly, when i add the 7th IF rule, no matter if its the exact same one from 1 to 6, page gives Unexpected $end.

Any ideas,

Is it possible to use the above code to look into every field to check if its empty???
 
Hi

patrickstrijdonck said:
Is it possible to use the above code to look into every field to check if its empty???
Code:
$field=array('adres','and','whatever','fields','you','have');

[url=http://php.net/foreach/]foreach[/url] ($field as $one)
  if (trim($_POST[$one])=='') echo "$one is empty";


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top