When you working with forms or APIs, you will have to use GET, POST, PUT or DELETE. So how to detect which type the form actually submit. By using below snippet you can detect the request type in PHP
$_SERVER['REQUEST_METHOD']
For example
if ($_SERVER['REQUEST_METHOD'] === 'POST') { // The request is using the POST method }
Did this post help you?
Tutsplanet brings in-depth and easy tutorials to understand even for beginners. This takes a considerable amount of work. If this post helps you, please consider supporting us as a token of appreciation:
- Just want to thank us? Buy us a Coffee
- May be another day? Shop on Amazon using our links.
Your prices won't change but we get a small commission.
Leave a Reply