Page 1 of 1

configuring php - can't read url variables

Posted: Fri Jul 16, 2004 1:06 pm
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!

Posted: Fri Jul 16, 2004 1:50 pm
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';
}

Posted: Fri Jul 16, 2004 2:01 pm
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';
}

Posted: Fri Jul 16, 2004 2:17 pm
by shazam-fu
Thanks, I'll give that a try!

Posted: Mon Jul 19, 2004 12:23 pm
by shazam-fu
That worked - thanks!