ชื่อฐานข้อมูล: tb_book
ฟิลด์ id_book int (11) AUTO_INCREMENT PRIMARY KEY
ฟิลด์ book_name vachar (30) NOT NULL
ฟิลด์ book_sur vachar (30) NOT NULL
 
FileName: connect.php

<?
$host="localhost";
$userdb="ceducat1_158html";
$passdb="xxxxxxxx";
$dbname="ceducat1_158html";

mysql_connect($host,$userdb,$passdb) or die ("Cannot User Connect");
mysql_select_db($dbname) or die ("Cannot DB Connect");

?>

 
FileName: form_add.html | Link: 

<html>
<head><title>Add Data</title></head>
<body>

<form name="form1" id="form1" method="POST" action="form_save.php">
Input NameBook:
<input name="txtBook_name" type="text" id="txtBook_name" /><p>
Input SurnameBook:
<input name="txtBook_sur" type="text" id="txtBook_sur" /><p>
<input type ="submit" name="submit" value="OK" />
</form>

</body>
</html>

 
FileName: form_save.php

<?
include ("connect.php");

$book_name = $_POST[txtBook_name];
$book_sur = $_POST[txtBook_sur];

$SQLinsert = "INSERT INTO tb_book (book_name,book_sur)
values('$book_name','$book_sur')";

mysql_query($SQLinsert);
echo"Input Data Complete<br>";
mysql_close();

?>

 
FileName: view_data.php | Link:

<?
include("connect.php");
$SQLselect = "select * from tb_book";
$SQLresult = mysql_query($SQLselect) or die (mysql_error());

while($show = mysql_fetch_array($SQLresult))
{
echo $show['id_book'];
echo $show['book_name'];
echo $show['book_sur'];
echo "<br>";
}
mysql_close();
?>