Re: Re: query strings coming from the same page going back to the same page

From: Date: Sat, 10 Apr 2004 23:22:55 +0000
Subject: Re: Re: query strings coming from the same page going back to the same page
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-183090@lists.php.net to get a copy of this message
going to try some different things out... the if statement didnt work cuz when i didnt put a query string at the end of the page name when going to it it complained about month being an undefined index... ----- Original Message ----- From: "Rainer Müller" <rainer.mueller@codingfarm.de> To: <php-general@lists.php.net> Sent: Saturday, April 10, 2004 6:33 PM Subject: [PHP] Re: query strings coming from the same page going back to the same page > Andy B schrieb: > > was wondering if this would work or do i need different code: > > <?php > > include("libs/conf.db"); > > if(($_GET['month']==0)||($_GET['month']>12)){ > > $query="SELECT > > Type, > > StartDate, > > EndDate, > > Name, > > County, > > Notes > > FROM $EventsTable > > ORDER BY StartDate DESC"; > > } else { > > $query="SELECT > > Type, > > StartDate, > > EndDate, > > Name, > > County, > > Notes > > FROM $EventsTable WHERE > > StartingMonth='{$_GET['month']}' > > ORDER BY StartDate DESC";} > > mysql_pconnect($host, $mysqluser, $mysqlpwd)||die(mysql_error()); > > $result=mysql_query($query) or die(mysql_error()); > > ?> > > then i would have a link on the same page this code came from: > > <a href="ViewEvents.php?month=1">Jan</a> > > the link is supposed to reload the same page it came from and be bart of the > > query above... the thing im not sure of is if that will work or not or do i > > need something else...(new to self referrencing pages)... > > Probably it is better to use > <a href="<?php echo $_SERVER['PHP_SELF']; > ?>?month=1">Jan</a> > Then it is not in dependency to the filename. > > And btw. you should check with is_numeric() if the value from > $_GET['month'] is really a number or you will have an security hole in > you script. > > Rainer > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#183090) next »