|
-
Jul 7th, 2003, 08:44 AM
#1
Thread Starter
Addicted Member
problem using PHP
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
-
Jul 7th, 2003, 09:05 AM
#2
You are probably running in safe mode or with register globals off..... both settings wich ensure a safer running machine.
-
Jul 7th, 2003, 09:12 AM
#3
Thread Starter
Addicted Member
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.
-
Jul 7th, 2003, 09:16 AM
#4
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.
-
Jul 7th, 2003, 09:20 AM
#5
Thread Starter
Addicted Member
i get what your meant~!
thanks,
i thought my web server problem, i try to reinstall many times.
=P
-
Jul 7th, 2003, 10:56 PM
#6
Stuck in the 80s
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|