[SOLVED] configuring php - can't read url 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

Post Reply
shazam-fu
Forum Newbie
Posts: 8
Joined: Mon Feb 23, 2004 1:22 pm

configuring php - can't read url variables

Post by shazam-fu »

Hi, I'm trying to help a client who wants to host their own site & just installed php on their web server. I gave them all the files for their site, which works at 2 independent hosts. However, their setup seems to be unable to read variables passed in the URL string.

For example, the URL might be http://www.test.com/test.php?thisvar=20 but when I reference $thisvar in the code within test.php, it doesn't have a value.

Is there something they need to do w/ their configuration to allow passing variables?

Thanks for your help!
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

some us some code....but do you have it $_GET['thisvar'] to reference the variable??

Code: Select all

if($_GET['thisvar'] == 20)
{
echo 'worked;
}
else
{
echo 'nope not going todo it';
}
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

well, his problem is that he's not using $_GET at all, so $thisvar is not even being assigned a value.

so, he should have

Code: Select all

if($_GETї'thisvar'] != '')
{
    $thisvar = $_GETї'thisvar'];
    echo $thisvar;
}
else
{
    echo 'Nothing was set';
}
shazam-fu
Forum Newbie
Posts: 8
Joined: Mon Feb 23, 2004 1:22 pm

Post by shazam-fu »

Thanks, I'll give that a try!
shazam-fu
Forum Newbie
Posts: 8
Joined: Mon Feb 23, 2004 1:22 pm

Post by shazam-fu »

That worked - thanks!
Post Reply