--- whoisquilty <[EMAIL PROTECTED]> wrote:
> I'm trying to set a variable for a series of "if" statements.
>
> if('PB'==$pg)
> {
> print '1';
> }
> if('B1'==$pg)
> {
> print '2';
> }
>
> And, I'd like the default to print 3 (in other words, not having set $pg to
> anything).
>
> However, if someone hits the page without $pg having a value, what do I do?
> In normal
> circumstances, I'd use an if/else statement. But I don't see how to do that
> with multiple if's.
>
> Jeremy
This sounds like a switch...case situation:
switch ($pg)
{
case "PB": // code for this value
break;
case "B1": // code for this value
break;
default: // code for any other values
}
http://php.net/switch
James Keeline
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/php-list/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/