Jump to content


Retrieving form data

  • Please log in to reply
3 replies to this topic

#1 Tandem

  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 25 September 2006 - 11:21 PM

When i'm retrieving form data, i usually use one of the following:

$blah = $_POST['blah'];
$blah = $_GET['blah'];

What other ways are there of retrieving form data, and if they work differently at all, how do they work? Just want to expand my knowledge of php a bit.

#2 trq

  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 25 September 2006 - 11:34 PM

The only other array is $_REQUEST and its just a catch all mix of $_GET and $_POST aswell as the $_COOKIE array.

#3 thepip3r

  • Members
  • PipPipPip
  • Advanced Member
  • 289 posts

Posted 25 September 2006 - 11:35 PM

Well aside from just calling the superglobal itself with the appropriate array reference, there is no other way.  You're always going to either use the array reference or load the array reference into a variable to use the pertinent data.  The only thing I might be able to add for your examples is using the $_REQUEST super global but this is bad practice as the $_REQUEST superglobal just holds data that gets posted from both $_GET and $_POST instead of either of them holding different data.

#4 HuggieBear

  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 25 September 2006 - 11:36 PM

Surely this is a case for RTFM :)

I'd never normally suggest it as I enjoy the challenges too much, but the manual's quite good on this subject.

Variables from outside PHP

Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users