I have code for store some data to data base. Before edit its success store database but problem is when I am refresh duplicate data.
I am edited and worked without any problem but when I press submit and store data to db I get an message error > why ?
this is form code (index.php)
<html>
<head>
<title>Proposals Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="columns.css" />
</head>
<body bgcolor="#3AA0BC">
<table border="5">
<form action="enterinfo.php" method="post"><br /><br />
<center> FirstName :<br /><input type="text" name="Name" id="Name" size="25"><br /><br/>
Title :<br /> <textarea name="title" id="title" size="50"></textarea></center>
<p><th><input type=submit value="OK" name="submit" id="submit"class="buttStyle"></th</p>
</form>
<form action="view.php" method="post">
<p><th><input type=submit value="عرض المواظيع" class="buttStyle"></th></p></form>
<form action="addcomment.php" method="post">
<p><th><input type=submit value="اضافة تعليق" class="buttStyle"></th></p>
</form>
</body>
</html>
and enter code is (enterinfo.php)
<?php
include ("connect.php");
$Name=isset($_POST['Name']) ?
$_POST['Name'] : '';
$title=isset($_POST['title']) ?
$_POST['title'] : '';
$submit = isset($_POST['submit']) ?
$_POST['submit'] : '';
if(isset($_POST['submit']))
{
if($Name && $title)
{
$result=mysql_query("INSERT INTO subject(S_Id,Name,title)
VALUES(NULL, '$Name', '$title')");
header('Location: enterinfo.php');
}
}
if($result)
{
echo "Successful";
echo "<BR>";
}
else
{
echo "error";
}
?>