Thursday, 8 August 2013

how does method POST processes/excecutes in PHP

how does method POST processes/excecutes in PHP

I am building a web application, I am having lots of confusion when ever I
use POST method.
Lets say I have the below code
<?php
if(isset($_POST['submit']){
echo "submit works";
header("Location:http://someexample.php");
die();
}
?>
<form method="POST">
<input type="text" name="textinput" />
<input type="submit" name="submit" value="submit" />
<input type="submit" name="clear" value="clear" />
</form>
so as per my understanding, If I am not wrong. When I click the SUBMIT /
CLEAR button. The PHP file reloads the self page first before redirecting
it to the header location.
If I am right. Is there any other way to avoid multiple redirects when we
are working on big PHP files. When I have multiple SUBMIT button.
thank you in advance

No comments:

Post a Comment