Re: conditional page loading

From: Date: Fri, 11 Aug 2000 20:37:48 +0000
Subject: Re: conditional page loading
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1980@lists.php.net to get a copy of this message
I have always handled this type of situation by having 1 page of the following design: <? // page header/layout stuff common to both pages ?> <? if ($num !=1){ ?> invalid user html stuff <? }// close of invalid user html else { ?> valid user html stuff <? } ?> page footer html stuff common to both pages -------- This allows you to keep your header and footer stuff common and only code it (and maintain it) in one place. What let's you do this is that you can escape out of PHP at any time (even in the middle of a conditional structure) without any problems. Just be sure to keep you braces matching! Hope this helps. Sincerely, John Parker umobiva@ostrichneck.org wrote: > > Hello, > does anyone know how to make php load a web page based on a > condition or another page based on another condition. > > For example, when a customer logs in, the login button calls > disclaimer.html page. This page connects to a mysql database to search a > customer/password cross reference table. > > This should return 1 row or 0 rows. > > I am grabbing the resulting number of rows like this: > > $num = mysql_numrows($result) > > then I have: > > if ($num == 1) { > <web page to load if this is a valid user> > } > else { > <web page to load if this user is invalid> > } > > I don't know what php uses to accomplish. I've tried looking through the > manual but nothing seems to suit this situation. > > Does anyone know what commands I need to do in the if/else statement to > redirect to one of 2 pages? > > TIA > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- John Parker, Design Engineer, Snorkel International Ph: 816/676-6419 Fax: 785/989-3556

« previous php.db (#1980) next »