Php, can't get two variables from url

I’m stuck on this one last detail. In this test php script I’m trying to use _GET to get two variables, site and pcode, from the calling url:

//test of string manipulation

$site = $_GET[‘site’];
$pcode = $_GET[‘pcode’];
echo $site, ‘
echo $pcode, ‘

//retrieve Prosser flow data from BOR database

echo $theurl, ‘


When I call the script with a line like lynx -dump

my echo lines show me that I got site set but not pcode. If I change my script call to lynx -dump , I get ‘pcode’ set but not ‘site’. Why can’t I get both set?

If I paste the url string into Firefox, it appears that both site and pcode get set. Is it just lynx that is giving me problems? Do I need to escape the & in the lynx line?

You need to quote the URL; otherwise, the shell ends up trying to run everything up to the & as one command in the background, then the rest as a separate command. Try this on for size:

Jebus! Another four hours of my life wasted while I tried to find the problem in with the php code!