Re: $_POST vs $_REQUEST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 23, 2010 at 2:39 AM, Slack-Moehrle
<mailinglists@xxxxxxxxxxxxxxx> wrote:
> Hi All,
>
> I have Forms that I submit for processing. I have seen examples of people using either $_POST or $_REQUEST.
>
> When would I choose one over the other?
>
> Also, I see examples of these being used with and without the single quotes
>
> Like:
>
> $_POST[j_orderValue]
> or
> $_POST['j_orderValue']
>
> Single quotes is best, correct to prevent sql injection?

You must use quote. either single or double. It wont affect sql injection.
Sanitize your data before using it in any sql.

$_REQUEST['var'] means a variable var was passed in http request.
$_POST['var'] means a post variable var was passed in http request.

A get or cookie variable var2 will set $_REQUEST['var2'].

When you are strictly expecting a Post variable 'var3' use
$_POST['var3'], not $_REQEUST['var3'].
This is because a $_GET['var3'] will make $_REQEUST['var3'] available
to you which is not what you want.

Correct me if I am wrong.


-- 
Shiplu Mokaddim
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux