i have created a registration page. when user fill it and submit a unique user_id will be given him. but problem is when user_id has been given if user refresh the page a new user_id will be alloted to him. if he refresh the page for thousand time a new uer_id will be alloted to him each time. how can i stop refreshing page or alloting new user_id.
my php code is :
<?php
if (isset($_POST)) {
$name=$_POST;
$dob=$_POST;
$address=$_POST;
$city=$_POST;
$state=$_POST;
$country=$_POST;
$pin=$_POST;
$mail=$_POST;
$web=$_POST;
$sex=$_POST;
$contact=$_POST;
$con = mysql_connect("********","*******","********");
if (!$con)
{
echo "Sorry, Server is not Responding this time, So Please Try After some time";
}
mysql_select_db("*****", $con);
$sql="INSERT INTO ******(name, dob, address, city, state, country, pin, mail, web, sex, contact)
VALUES
('$name','$dob','$address','$city','$state','$country','$pin','$mail','$web','$sex','$contact')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else {
$result = mysql_query("SELECT user_id, name FROM ****** WHERE dob = '$dob' AND name ='$name'");
echo "<table border='1'>
<tr>
<th>User_ID</th>
<th>Name</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row . "</td>";
echo "<td>" . $row . "</td>";
echo "</tr>";
}
echo "</table>";
}
}
mysql_close($con);
?>