RE: [PHP] Still can't pass variable through url

From: Date: Fri, 08 Aug 2003 06:58:59 +0000
Subject: RE: [PHP] Still can't pass variable through url
Groups: php.general 
Request: Send a blank email to php-general+get-158785@lists.php.net to get a copy of this message
This _might_ be causing you problems... $month=march; strings should be quoted (unless you've define("march", "march")'ed it...) $month='march'; Martin -----Original Message----- From: Joe Harman [mailto:joe@harmanmedia.com] Sent: Friday, 8 August 2003 4:55 PM To: php-general@lists.php.net Subject: RE: [PHP] Still can't pass variable through url <?php $year=1999; $month=march; echo "<a href=\"http://www.thingamajigger.com/index.php?year=$year&month=$month\" >yeah this is the link</a>"; ?> > -----Original Message----- > From: John Manko [mailto:xerid@adelphia.net] > Sent: Friday, August 08, 2003 2:47 AM > To: Martin Towell > Cc: 'Jack'; php-general@lists.php.net; php-windows@lists.php.net > Subject: Re: [PHP] Still can't pass variable through url > > > actually, you might want to urlencode it. > ok, so i doubt that you would need url encoding for $year and $month, > but I'm sure you will playing with more of this in the future, so you > should properly prepare to do so. Note: browsers will do > formatting for > you, but don't rely on it. > > "page.php?year=" . urlencode($year) . "&month=" . urlencode($month) > > > Martin Towell wrote: > > >See if changing it to > > page.php?year=$year&month=$month > >works > > > > > >The separator between the page and the query string is "?" > >The separator between each key/value pair is just "&" > > > >-----Original Message----- > >From: Jack [mailto:nedcor4@nedcor.com.hk] > >Sent: Friday, 8 August 2003 4:30 PM > >To: php-general@lists.php.net; php-windows@lists.php.net > >Subject: [PHP] Still can't pass variable through url > > > > > >Dear all > >I had set the "register_global=on" and "magic_quotes_runtime=off" > >already, but when i click my hyperlink > >"page.php?year=$year&?month=$month", it doesn't pass the > variable for > >?year and ?month to the destination page "page.php" I'm > using php 5.0 > >above , if the same case apply to php4.04, then there is no > problem at > >all! Can anyone please give me more help on this? > > > >Thx alot > >Jack > >

« previous php.general (#158785) next »