hi,
i tried my php on IIS n apache2,
when i try to do this
http://localhost/index.php?product_name=abcdef
in my script, $product_name will not appear as abcdef, why?
P/S: when i using phpMyAdmin, it did not give me the problem
Printable View
hi,
i tried my php on IIS n apache2,
when i try to do this
http://localhost/index.php?product_name=abcdef
in my script, $product_name will not appear as abcdef, why?
P/S: when i using phpMyAdmin, it did not give me the problem
You are probably running in safe mode or with register globals off..... both settings wich ensure a safer running machine.
there is no problem if i use
echo $_REQUEST['product_name'];
but why i can't use $product_name strightly?
register globals off?
can u teach me how to solve this problem?
im running apache2 or iis only win2k pro.
turning Register Globals on is a very dangerous thing to do... in fact no one that I know of would recommend turning it on.....
Your best bet is to use
$product_name = $HTTP_GET_VARS['product_name'];
The reason being is that it prevents someone from junking up your URL and running unauthorized code on your machine. The ability to use the globals in the manner you mentioned was from older version and is only included as a depreciation method. If you are running anything newer that 4.0, I'd use the HTTP_GET_VARS, it's simply safer.
i get what your meant~!
thanks,
i thought my web server problem, i try to reinstall many times.
=P
I'm still confused about why everyone wants to avoid using $_POST['variable'].
And try to use $_POST and $_GET as much as possible. Only use $_REQUEST if it may come by either method.