Re: New to php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

<*> 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/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux