What I have learnt is: At a time, only HTTP POST or GET method is possible. I have the following piece of code named: index.php
<?php
if($_SERVER['REQUEST_METHOD'] == "POST") {
echo "Request Method is: ". $_SERVER['REQUEST_METHOD'] .'<br>';
echo "Get variable is: " . $_GET['getname'] . '<br>';
echo "Post variable is: " . $_POST['posttitle'];
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Testing Get or Post</title>
</head>
<body>
<form action="" method="POST">
<input type="text" name="posttitle" value="somepost"/>
<button type="submit">Submit</button>
</form>
</body>
</html>
I navigate the form via : http://localhost/testing/index.php?getname=someget. I submit the form, and the form data is sent via HTTP POST method.
Now my question is: In this scenario, the HTTP method is POST, and the GET variable $_GET['getname'] should have been unavailable. But, both POST and GET variables are available and printed.