Re: basic php problem
| From: | nicolas figaro | Date: | Thu, 15 Jun 2006 13:16:02 +0000 |
| Subject: | Re: basic php problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238087@lists.php.net to get a copy of this message | ||
Ross a écrit :
I want to set a page number of a page if(!isset($_REQUEST['page'])) { $page =$_REQUEST['page'] + 1; echo "page is ".$page; // this echos out page is 1 } The problem is when I try and use $page further down in the body $page is 0 Question <?=$page; ?> <BR /> <? echo "page is".$page; ?> <?=$question[($page-1)]; ?> I also get an undefined index notice Notice: Undefined index: page in c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8 page is 1 but I though if I do a if(!isset($_REQUEST['page'])) this is the way to set a previously undefined index? you have to check if page exists in $_REQUESTif (!array_key_exists($_REQUEST,"page")) { $page = 1; } why do you wish to add something that's not set to a constant value ? $page =$_REQUEST['page'] + 1; NF
Ross