Using HTTP Request variables instead of HTTP GET and Post variables

Posted by Shek on March 10, 2011 under PHP | Be the First to Comment | Total View: 3,701 views

In this post, I would like write a little note on using
$_REQUEST instead of $_GET or $_POST
in the future of my programming for most of the cases.

In cases such as fetching data from HTML form:

Instead of:

$name = $_POST["name"];
$age = $_POST["age"];
$name = $_GET["name"];
$age = $_GET["age"];

I will use:

$name = $_REQUEST["name"];
$age = $_REQUEST["age"];

I found that it is a good habit to unify and simplify the way I program, and would like o recommend to my readers.

If you have other ideas to unify and simplify in PHP programming, please do share in the comment section below with me.

Not what you want? Try a Search

Add A Comment