Re: IF Statements

From: Date: Mon, 14 Jan 2002 03:19:13 +0000
Subject: Re: IF Statements
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-80413@lists.php.net to get a copy of this message
if ($action=='list') { if (!$clientcode) { <old_code> } else { <new_code> } } I put the $clientcode test inside the $action test because I suppose you take different actions on $clientcode depending on $action - if that's not the case, simply switch the two if's. This assumes that $clientcode>0. If you also use 0, then test if (!isset($clientcode)) instead. Bogdan Necro wrote: > I have a page for listing the contents of a table from my db. > Being client.php?action=list > As the action variable also allows for adding extra to the table, etc. > > Once I use ?action=list I want to be able to click on a single record and > have it give me the extended info. > so client.php?action=list&clientcode=(the clients id in the db) > > My problem is working out how to evaluate this new part. I have normal If > statements for the listing, adding, etc. But how can I get it to check if > clientcode is present. If clientcode is not present I want it to load the > list page as normal. But if the clientcode is present then it is to load > something else. > > How do I structure my IF statement? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#80413) next »