On Thu, June 15, 2006 8:11 am, Ross wrote: > I want to set a page number of a page > > if(!isset($_REQUEST['page'])) { > $page =$_REQUEST['page'] + 1; These two together make no sense at all... If the $_REQUEST['page'] is NOT set, then why use it? It's NOT THERE. > echo "page is ".$page; // this echos out page is 1 > } Here is a more sensible approach: //use page requested, or default to page 1: $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; You can write that as a 6-line if statement if you like: if (isset($_REQUEST['page']){ $page = $_REQUEST['page']; } else{ $page = 1; } > The problem is when I try and use $page further down in the body $page > is 0 In that case, you are on ?page=2 in your script, and you didn't do ANYTHING about $page in the original version. > 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? No. isset() CHECKS if a variable/index is set. It does not alter anything at all. It just tests. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php