PHP $_REQUEST
But what if you want your php to work for both post and get datas in the same time, to precess the form whatever it was in post method or get method, you will then think to use if conditions to check whether of two methods was used:
if (isset($_POST['var']))
// process data...
if (isset($_GET['var']))
// process data in the same way...
BUT there is a little and usefull solution: $_REQUEST, because $REQUEST can get any form field value, whatever it was GET or POST method, it does not care.
This means that $_REQUEST['var'] = $_POST['var'] if the form was in post method, and $_REQUEST['var'] = $_GET['var'] if the form was get. ('var' is the field name you want to get its value)
So now you will not care what method the form use :)
You can also use isset() with $_REQUEST, for example:
if (isset($_REQUEST['var'])) is the same than if ( isset($_POST['var']) or isset($_GET['var']) )
I hope this little tip will help you, we will provide best php tips, scripts as well as php tutorials.
13 comments:
- SOMESPECIAL said...
-
Thanks so much
- June 1, 2013 at 2:42 AM
- PHP Tutorial For Beginners with Examples PDF said...
-
excellent piece
- February 1, 2015 at 10:09 AM
-
-
Yeah.. nice info.. Thnx bro.. :)
- July 26, 2015 at 6:09 AM
- Unknown said...
-
This fundamentals of PHP programming helped me to improvise my skill set in PHP development.
Regards,
PHP Training in Chennai|PHP Course in Chennai - April 18, 2016 at 12:09 AM
- Unknown said...
-
Superb explanation & it's too clear to understand the concept as well, keep sharing admin with some updated information with right examples.Keep update more posts.
Digital Marketing Company in Chennai - February 16, 2017 at 10:42 PM
- mani said...
-
Thanks for your informative blog!!! Your article helped me to understand the future of Core Java programming language. Keep on updating your with such awesome information.
White Label Website Builder - August 10, 2017 at 12:06 AM
-
-
Thanks for sharing the information about PHP Training Chennai .
PHP Training in Chennai
PHP Course in Chennai - October 7, 2017 at 1:59 AM
- Unknown said...
-
I went through your blog and it’s totally awesome. Keep on updating your site with such informative post. If possible please include rss feed for your blog.
web designing course in chennai|Best web designing institute in chennai - October 12, 2017 at 5:41 AM
- Blogger said...
-
Hey, Wow all the posts are very informative for the people who visit this site. Good work! We also have a Blog.Please feel free to visit our site. Thank you for sharing.
php training center in indore
Keep Posting:) - November 29, 2017 at 3:43 AM
- Ancy merina said...
- This comment has been removed by the author.
- February 18, 2018 at 11:58 PM
- Pro Integrate said...
-
Pro Integrate is one of the best technology companies which gives you the best services and also provides mixed working environment On-Site as well as Nearshore. The goal of our company is to help match employers who have job openings with qualified employees who are available. We provided specific resources, as requested, to be integrated in our partner’s projects. Business consultancy like us provides information, consulting, and insights to importers and exporters so that they can take accurate decisions.
- June 8, 2018 at 4:34 AM
- Unknown said...
-
We provide Digital Marketing Services and we have high conversion rates. We help our clients significantly increase the number of customers in the shortest amounts of time.
- June 27, 2018 at 4:58 AM
-
-
How to deposit money at a casino | TrickToAction.com
The top 10 deposit 프랑스 리그1 순위 methods for depositing money at a 다 파벳 casino · 1. Create a 토토왕뚜껑 new account with the casino's deposit page, then start 스포츠토토 부스 샤오미 by creating a new account 안전한 토토사이트 샤오미 with - March 15, 2022 at 4:26 AM
Search With Google
Categories
- 1-General (3)
- 2-Getting started (4)
- 3-Strings (10)
- 4-Server config (1)
- 5-Best scripts (7)
- email (4)
- files (6)
- Forms (3)
- If statements (3)
- Loop statements (2)
- Mysql (2)
- Server variables (3)
- Sessions (1)
- Tutorials-planet.com (1)
- web hosting (1)
- You need a programmer ? (1)
Links to visit !
Blog Archive
-
▼
2010
(12)
-
▼
January
(10)
- String Capitalization Functions: strtoupper-strtol...
- PHP For Loop
- PHP Validate Email Address: Email Validator
- PHP Random code Generator
- PHP Get browser Language
- PHP $_REQUEST
- PHP send mail SMTP authentification
- ob_start - save php output to a string - The PHP o...
- PHP send HTML email, The complete php mail sending...
- PHP mail() - send email with php
-
▼
January
(10)