Friday, 9 May 2014

stop inserting data in the database when refreshing the page.

The best way to prevent that is to add header('Location: filename') after your query. Thus in your case,
if (isset($_POST['submit'])) 
$user= $_POST['username'];
$email = $_POST['useremail'];
$pass= $_POST['password']; 

mysql_query("INSERT INTO table (username, useremail, email) VALUES ('$username','$useremail','$email');
//must be inside the condition to prevent too many redirects
header('Location: user_details_page.php');

Software Developer in php (3 - 5 years , 2.00 - 12.00 Lacs) interview question Neosoft Technologies

Laravel 5 Eloquent Explained in the Simplest Way Facades in Laravel. Why and How? How to Register & Use Laravel Service Providers ...