I would add another construct, which will give you more flexibility in the future: switch($_GET['pageName']) { //if you're not sure how the variable will pass use $_REQUEST['pageName'] case '': //load requested page break; case '': //do something else break; default: //function or load default page break; } -----Original Message----- From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of Jason Reed Sent: Friday, November 25, 2005 2:35 AM To: php-objects@xxxxxxxxxxxxxxx Subject: Re: New to php Hi there, I'm gathering from your question you are looking to test the variable pageName from the url like: http://www.yoursite.com/index.php?pageName=smoke and if there is no pageName then set load the default. Personally I would right it like this. if(isset($_GET['pageName'])){ // load the requested page }else{ // load the default page } The $_GET variable is a Superglobal that breaks down the request of the GET (everything after the ? in the URL). If you are unsure if this comes from the GET method you can also use the superglobal $_REQUEST which is another array that handles both GET and POST methods. You check to see if the array element is actually given a value using the isset() function. If you attempted an is_null() function and there is no element then PHP will throw a warning. I hope this helps you on your way. --- In php-objects@xxxxxxxxxxxxxxx, "hd85flt" <hd85flt@xxxx> wrote: > > I'm crossing over from ColdFusion and I use a database to deliver > content based on "pageName". I would like to test for page name and if > it doesn't exist, reload the default page content. I find my sites > work until I type a url string that doesn't exist in the database, > then I get sql errors on the page for navigation results because > "parentID is "null". Its so easy in ColdFusion but I just don't get it > here... > ------------------------ Yahoo! Groups Sponsor --------------------~--> 1.2 million kids a year are victims of human trafficking. Stop slavery. http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/