php - stop inserting data in the database when refreshing the page -


i looking way stop inserting or sending data in database when refreshing page.

here code:

user_details_page.php

<form action="confirm_page.php" method="post" > user name:   <input  type="text" name="username" > user email <input  type="text" name="useremail" > password:   <input  type="text" name="password" > <input type="submit"  name="submit" > </form> 

confirm_page.php

if (isset($_post['submit']))  { $user= $_post['username']; $email = $_post['useremail']; $pass= $_post['password'];   mysql_query("insert table (username, useremail, email) values ('$username','$useremail','$email');  } 

so problem everytime refresh confirm page.php data sent database. how stop this?

header user new page :

if (isset($_post['submit']))  {   $user= $_post['username'];   $email = $_post['useremail'];   $pass= $_post['password'];     mysql_query("insert table (username, useremail, email) values(`$username','$useremail','$email')");  } //best outside if statement user isn't stuck on white blank page. header("location: landing_page.php"); exit; 

by doing user refreshes refreshing landing_page.php means won't insert twice.

best advice: check see if user exists first if don't insert!


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -