can't get the value of fields in a form

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
Skeletor
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio
Contact:

Thu Mar 20, 2003 5:53 pm

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.

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

Thu Mar 20, 2003 6:46 pm

I have never heard of / used $_REQUEST, but for forms I use $_POST
Terra Design, my business and sole / huge PHP project... a fully dynamic and adaptive site engine.

Skeletor
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio
Contact:

Fri Mar 21, 2003 4:30 am

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.

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sat Mar 22, 2003 11:36 pm

read change log.

register globals!

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Wed Sep 24, 2003 10:09 pm

try

echo $_REQUEST['firstname'];

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Wed Sep 24, 2003 11:01 pm

Depending upon your info travelling path

It is always better to use
$_GET['var_name']
$_POST['var_name']

psychomantum
New php-forum User
New php-forum User
Posts: 10
Joined: Sat Dec 07, 2002 8:04 pm

Thu Sep 25, 2003 9:43 pm

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!

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Thu Sep 25, 2003 9:47 pm

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

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests