can't get the value of fields in a form

A

Anonymous

Guest
use either one of these two things:
$_GET['var']
$_REQUEST['var']

you can't access the $var directly unless your global variables setting is turned on.
 
I have never heard of / used $_REQUEST, but for forms I use $_POST
 
http://www.php.net/manual/en/reserved.variables.php

It's an associative array consisting of $_GET, $_POST, and $_COOKIE variables. If you use $_REQUEST, you can access either get, post, or cookie variables.

It looked like he was referencing it from a URL, so that's why I recommended either $_GET or $_REQUEST. $_REQUEST is just a handy one to use if you don't know where it's coming from.
 
Depending upon your info travelling path

It is always better to use
$_GET['var_name']
$_POST['var_name']
 
I would also suggest that you stick to this method and not register globals. I made the mistake of learning with register globals on, and I learned the hard way that it is a security risk, not to mention it can get sloppy.

There is no space between $_REQUEST and the ['var'], it's all one entity, $_REQUEST['var']

Just please, please DO NOT REGISTER GLOBALS!
 
Please read a sticky or the announcement on the PHP General group writen by one of our Mod, Very necessary you read it
TURN OFF REGISTER GLOBALS
 
Back
Top