when we open registration webpage, an empty data gets inserted into database as well as on browser refresh. we have tried:
header("Location: addcandidate.php");
exit(0);
we have tried to put this code after all $_POST values and also at beginning of page. we are getting error as:`Cannot modify header information - headers already sent
$addcandidate1=$_POST['candi_a_fname'];
$addcandidate2=$_POST['candi_a_lname'];`
header("Location: addcandidate.php");
exit(0);
mysql_connect('localhost','root','') or die(mysql_error());
echo "connected";
mysql_select_db('talent') or die(mysql_error());
echo "database selected";
$error = NULL;
if (!$error)
{
mysql_query("insert into candidate(cand_fname,cand_lname) values ('$addcandidate1','$addcandidate2')") or die(mysql_error());
echo 'alert("Your Data Has Been Successfully Inserted ! Thank You")';
}