How does a checking for submit button is pressed in php work?
I'm curious about this kind of behavior, suppose the code below:
<form name="myfrom" action="" method="post">
Username: <input type="text" name="user" id="username" />
<input type="submit" name="submit_form" value="Submit" />
</form>
<?php if($_POST['submit_form'] == "Submit") {
echo "do something";
}
?>
What is the reason it works? Is that because when you click on submit
button the page reloads again and then the php script runs again? Does
someone have any explanation about it?
No comments:
Post a Comment