insert.php
<?php
$dbun = "$_POST[dbun]";
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$sql="INSERT INTO $dbun (sn, date, particular, dr, cr)
VALUES
('$_POST[sn]','$_POST[date]','$_POST[ptr]','$_POST[dr]','$_POST[cr]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
DB name = my_db
user.php
<html>
<body>
<form action="db.php" method="post">
NEW DATA BASE USER: <input type="text" name="snn" />
<input type="submit" />
<br>
<form action="db.php" method="post">
DATA BASE USER NAME: <input type="text" name="dbun" />
<input type="submit" />
</form>
</body>
</html>
db.php
<?php
$snn = "$_POST[snn]";
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Create table
mysql_select_db("my_db", $con);
$sql = "CREATE TABLE $snn
(
Sn int,
Date int,
Particular varchar(15),
Dr int,
Cr int
)";
// Execute query
mysql_query($sql,$con);
mysql_close($con);
?>
index.php
<form action="insert.php" method="post">
DB User name:
<input type="text" name="dbun" />
<br>
Sn:
<input type="text" name="sn" />
<br>
Date:
<input type="text" name="date" />
<br>
Particurar:
<input type="text" name="ptr" />
<br>
Dr:
<input type="text" name="dr" />
<br>
Cr:</span>
<input type="text" name="cr" />
<br>
<br>
<input type="submit" />
</form>
<a href="user.php">USER</a></span>
<a href="output.php">OUT PUT</a>
</body>
</html>
My question is how to edit my sql data that already entered with html post plz help....