refresh - How can I disable someone refreshing a page? -


i made php code add name,email,etc added table , when click refresh, same rows of information appear , don't want happen if user refresh page...

ok, have page1.php can enter info , redirect page2.php when click f5 enters same info again

(i idiot-proofing - if wants refresh page or accidentally refreshes it, right?)

page1.php:

<html> <body>  <form action="page2.php" method="post"> firstname: <input type="text" name="firstname" /> lastname: <input type="text" name="lastname" /> email: <input type="text" name="email" /> <input type="submit" /> </form> </body> </html> 

page2.php:

$sqlinsert="insert sampletable (firstname, lastname, email) values ('$_post[firstname]','$_post[lastname]','$_post[email]')";  if ($conn-> multi_query($sqlinsert) === true) {  echo "new record created successfully.<br>";  } else { echo "error: " . $sqlinsert . "<br>" . $conn->error; }  $conn->close(); 


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -