It would seem trivial:
<?php if(isset($_POST['submit_name']) { echo 'Yahoo!'; } else { echo 'Drawn'; } ?>
But it was not there. When you press F5 (update), the button always comes down, even if we have not pressed one at all.
It would seem trivial:
<?php if(isset($_POST['submit_name']) { echo 'Yahoo!'; } else { echo 'Drawn'; } ?>
But it was not there. When you press F5 (update), the button always comes down, even if we have not pressed one at all.
Already found a solution to this problem. You can get around this glitch like this in this simple way:
<input type="hidden" value="" name="check" id="check">
Add the following Js-kod:
document.getElementById("check").value="checked"
In the php script add the following code:
if(isset($_POST['check'])&&$_POST['check']==checked")
// ....
unset($_POST['check']);
profit.
Well, or yes, FLK, you can search in that way.
header("Location: ".$_SERVER["PHP_SELF"]);
where it has already been discussed, the reason is that when you press f5 post, the request on some browsers is sent again in full. to prevent this, you need to bind to the session or to something permanent (database, file, cookies) and check for the uniqueness of $ _POST
echo "<META HTTP-EQUIV='Refresh' CONTENT='1; URL='''>";
Source: https://ru.stackoverflow.com/questions/102315/
All Articles