Specifications

<body>
<h1>Book-O-Rama - New Book Entry</h1>
<form action=”insert_book.php” method=”post”>
<table border=0>
<tr>
<td>ISBN</td>
<td><input type=text name=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>
The results of this form are passed along to insert_book.php, a script that takes the details, per-
forms some minor validations, and attempts to write the data into the database. The code for
this script is shown in Listing 10.4.
LISTING 10.4 insert_book.phpThis Script Writes New Books into the Database
<html>
<head>
<title>Book-O-Rama Book Entry Results</title>
</head>
<body>
<h1>Book-O-Rama Book Entry Results</h1>
<?
if (!$isbn || !$author || !$title || !$price)
Accessing Your MySQL Database from the Web with PHP
C
HAPTER 10
10
ACCESSING
YOUR MYSQL
DATABASE
239
LISTING 10.3 Continued
13 7842 CH10 3/6/01 3:36 PM Page 239