Rather than just setting globals on in php.ini, try this: Your printf() line is: printf("Variables: %s\n<br>", $HTTP_GET_VARS["id"]);
And your if() statement is: if($id) {} Where is $id set? It's probably not. $HTTP_GET_VARS["id"] doesn't set $id. If you want the "id" variable in your if(), you need: if($HTTP_GET_VARS["id"]) {} Or alternately do: $id = $HTTP_GET_VARS["id"] if($id) {} Although that's not necessary. Also, try using $_GET["id"], as $HTTP_GET_VARS[] has been deprecated in newer versions. HTH, Jason Soza ----- Original Message ----- From: <[EMAIL PROTECTED]> Date: Tuesday, June 11, 2002 8:16 am Subject: [PHP] Different Problem [Re: Passing a Variable to PHP Via the URL] > I found out that in fact PHP is creating a variable with the name > and value I'm passing through a URL from the querystring. But > it's still not working as planned. > > The url server/test.php?id=1 creates the following results in my code: > > printf("Variables: %s\n<br>", $HTTP_GET_VARS["id"]); > > This line works - there IS a variable named 'id' in my page and it > has the correct value, 1. > > if ($id) {} > > This fails. If I test 'id' instead of '$id' then it works but my > page doesn't seem to equate 'id=1' with the presence of $id. > > $result = mysql_query("SELECT * FROM employees WHERE id=$id",$db); > > This doesn't work - again it seems $id isn't being treated > properly. I get this error: > > Warning: mysql_fetch_array(): supplied argument is not a valid > MySQL result resource > > If I hardwire my page with the line '$id=1;' before the if > statement and the query everything works. > > So why isn't the variable from my URL being treated properly? > > Jesse > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php