can't get the value of fields in a form

Ask about general coding issues or problems here.

Moderators: macek, egami, 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:

Post by Skeletor » 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:

Post by Xerpher » Thu Mar 20, 2003 6:46 pm

I have never heard of / used $_REQUEST, but for forms I use $_POST

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

Post by Skeletor » 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: 831
Joined: Sun Jun 02, 2002 3:09 am

Post by Oleg Butuzov » Sat Mar 22, 2003 11:36 pm

read change log.

register globals!

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

Post by Redcircle » Wed Sep 24, 2003 10:09 pm

try

echo $_REQUEST['firstname'];

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

GET & POST

Post by ruturajv » 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

Post by psychomantum » 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: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Sticky Announcement

Post by ruturajv » 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

Who is online

Users browsing this forum: No registered users and 4 guests