PHP & MySQL | Tutorials

David Carr

Detecting dynamic form submissions with php

Here's a very simple way to detect if a form has been submitted, I've recently wrote a plugin for dynamic forms. 

The problem I had was being able to detect when a form was submitted, normally I would check for submit name array within the post array but since the plugin allows for full control over the form's elements including the submit button's name I had to do it a different way.

I could of had a hidden field in the form and then check for that but a much simpler way is letting the server detect the method request:

if($_SERVER['REQUEST_METHOD'] == 'POST'){
//submitted
}

 

Domains are often purchased from multiple providers, keeping track of where a domain is and its DNS settings can be tricky. Domain Mapper solves this by listing all your domains in one place. View your DNS settings and receive reminders to renew your domains. Try it today.

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2009 - 2021 DC Blog. All code MIT license. All rights reserved.