GET and POST variables using PHP, the lazy way

If you want to catch form variables in $<variable name> format instead of the $_GET['variable name'] or $_POST['variable name'] format, just call import_request_variables() at the start of your script and supply either a ‘p’ or a ‘g’ argument for post or get respectively.  Kind of nice for those lazy programmer out there.

For example, if you had an “email” variable submitted from your form and wanted to use $email instead of using $_POST['email'] in the script that gets the submission, or lets say you inherited a script where somebody wrote their code using the lazy format, then import_request_variables will come in handy.

The function’s second, optional parameter also specifies a prefix for your variable.  You could also set register_globals = on if you didn’t want to use the import_request_variables function. 

Comments

gps garmin price新建文章 1

,flip hd camcorders

it is ok

 

................................................

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
10 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.