I have a page with a form. Which of the following methods is the best to use to check if the form is submitted? And how are they different?
Method 1:
if($_SERVER['REQUEST_METHOD'] == 'POST'){
//some code
}
Method 2:
if(isset($_POST['submit'])){
//some code
}
Method 3 (obviously if I add submitted=true
on submit to the query string):
if($_GET['submitted'] == true){
//some code
}