-2

problem testing

<form method="post">
    Name:<input type="text" name="check" action="">
         <input type="submit">
</form>
<?php
if($_SERVER['REQUEST_METHOD']=='POST')
{
    $store=$_POST['check'];
    if(empty($store)){
        echo 'empty';
    }
    else{
        echo $store;
    }


}
?>
</body>
</html>

i am trying to reloading / refreshing my page after submitting my form i don't know why i am not enable to refresh my web page i got one pop up message [[ CONFORM FORM SUBMISSION ]] i click on continue does not effect any thing still i can't refresh my page !

  • What makes you think it is not refreshing? – Patrick Q Mar 04 '16 at 13:37
  • Well you will reload the form submission. Instead make a redirection to the same page with window.location or header(). – Keyne Viana Mar 04 '16 at 13:38
  • http://stackoverflow.com/questions/6320113/how-to-prevent-form-resubmission-when-page-is-refreshed-via-php – izk Mar 04 '16 at 13:42
  • after a form submission if you refreshing a page it will resubmit the form. this is the reson browser confirming the resubmit. you can use ajax form submission or you have to redirect using php – Vigikaran Mar 04 '16 at 13:42
  • There is nothing wrong in this code that popup warns you to for form data re submission. – Huzoor Bux Mar 04 '16 at 13:43
  • when you submit form after that page load you see you output value of text field or empty message. then you again refresh the page it say you that would you like to update form with previous value. so nothing is wrong here in code. https://en.wikipedia.org/wiki/Post/Redirect/Get – Hamza Zafeer Mar 04 '16 at 13:46
  • Page name Plz ? *Something.php* ? – Nana Partykar Mar 04 '16 at 13:52

1 Answers1

0

The html of the form is incorrect. It should be:

<form method="post" action="">
    <label>Name:</label><input type="text" name="check"/>
    <input type="submit" value="submit"/>
</form>
  • The above code is what you would normally want. It should work unless you want your code to affect another http cycle. Tell us more about what you want your code to do to help us to help you better. –  Mar 04 '16 at 14:03