newbook.php
<html>
<head>
<title>Book Entry</title>
</head>
<body>
<h1>Book Entry</h1>
<form action="insert_book.php" method="post">
<table border=0>
<tr>
<td>ISBN</td>
<td><input type="text" name='book_isbn' maxlength=13 size=13><br></td>
</tr>
<tr>
<td>Author</td>
<td> <input type="text" name='author' maxlength=30 size=30><br></td>
</tr>
<tr>
<td>Title</td>
<td> <input type="text" name='title' maxlength=60 size=30><br></td>
</tr>
<tr>
<td>Price $</td>
<td><input type="text" name='price' maxlength=7 size=7><br></td>
</tr>
<tr>
<td colspan=2><input type='submit' value="Register"></td>
</tr>
</table>
/form>
</body>
</html>
insert_book.php
<html>
<head>
<title>Entry Results</title>
</head>
<body>
<h1>Book Entry Results</h1>
<?php
require_once("db_connect.php");
$book_isbn =$POST['book_isbn'];
$author = $POST['author'];
$title = $POST['title'];
$price = $POST['price'];
if((!$book_isbn) || (!$author) || (!$title) || (!$price))
{
echo "You did not submit the following required information! <br />";
if(!$book_isbn){
echo "Book ISBN is a required field. Please enter it below.<br />";
}
if(!$author){
echo "Author is a required field. Please enter it below.<br />";
}
if(!$title){
echo "Title is a required field. Please enter it below.<br />";
}
if(!$price){
echo "Price is a required field. Please enter it below.<br />";
}
include 'newbook.php';
exit();
}
else{
$query = "INSERT INTO books (,book_isbn, author, title, price) VALUES('', '$book_isbn', '$author', '$title', '$price')";
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows()." book inserted into database.";
}
?>
</body>
</html>
anyhow after i run again and again, edit here edit there still the same as blak page except Book Entry Results print out. Is that the inserting part not really "INSERT" into the BOOKS table?
I bet experts are tiring answer my question, but i think i would give it a last try. SIGH@
😕
Thank everybody anyway, batman Damien_Buttler crosbystillsnas
Xoid Norman Graham