PHP not keeping variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Lostnode
Forum Newbie
Posts: 15
Joined: Thu Oct 13, 2005 1:37 am

Post by Lostnode »

Burrito wrote:lose the quotes

Code: Select all

$cntry = $_GET['cntry'];

if ( $cntry == '' ) //This is line 12, and its 2 x ' not " 
{ 
   echo "Please select a country<br><p>"; 
}
damn it, either you edited or I missed it :P

anyway, try print_r'ing your $_GET[] array to see what it shows...
Yeah I edited after I realized that I had tried it both ways .
Lostnode
Forum Newbie
Posts: 15
Joined: Thu Oct 13, 2005 1:37 am

Post by Lostnode »

Ok, here is what I get when I print_r my $_GET['cntry']

Code: Select all

parse error: parse error, unexpected T_VARIABLE in /home/un/public_html/channels/index.php on line 11
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

Code: Select all

<?
print_r($_GET);
?>
8O
Lostnode
Forum Newbie
Posts: 15
Joined: Thu Oct 13, 2005 1:37 am

Post by Lostnode »

Burrito wrote:

Code: Select all

<?
print_r($_GET);
?>
8O
Meh... Ok...

I also tried

Code: Select all

print $_GET['cntry']
and it came out with the right values.
Lostnode
Forum Newbie
Posts: 15
Joined: Thu Oct 13, 2005 1:37 am

Post by Lostnode »

Ok..... works now.... dunno how....
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

so try setting $cntry to the URL param and echoing it out...

/me is starting to think there's something else wrong here, post your updated code and I'll look over it more closely.
Post Reply