this code is quite simple to set up
lets begin with the database connection
call it database.php
<?php
$dbhost = 'localhost';
$dbuser = 'username';
$dbpasswd = 'password';
$database = 'database';
$connection = mysql_pconnect("$dbhost","$dbuser","$dbpasswd")
or die ("Couldn't connect to server.");
$db = mysql_select_db("$database", $connection)
or die("Couldn't select database.");
?>
after you have built the database.php it is reusable in any php file you create that needs a database connection.
Now lets begin with the form coding
<head>
<title>Post Books</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
include 'database.php';
if (!$REQUEST['action']) {
echo "<form method='post' action='form.php'>";
echo "<input type='hidden' name='action' value='1'>";
echo "<table border='1'>";
echo "<tr>";
echo "<td>Name</td>";
echo "<td><input type='text' name='name'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Email</td>";
echo "<td><input type='text' name='email'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Phone</td>";
echo "<td><input type='text' name='phone'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Title</td>";
echo "<td><input type='text' name='title'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Author</td>";
echo "<td><input type='text' name='author'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>ISBN</td>";
echo "<td><input type='text' name='isbn'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>University</td>";
echo "<td><input type='text' name='universsity'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Condition</td>";
echo "<td><input type='text' name='condition'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Price</td>";
echo "<td><input type='text' name='price'></td>";
echo "</tr>";
echo "</table>";
echo "<p align='center'><input type='submit' value='Submit Request'></p>";
echo "</form>";
} elseif ($REQUEST['action'] == 1) {
$query = "INSERT INTO books
(name,email,phone,title,author,isbn,university,condition,price)
VALUES
('".$POST['name']."', '".$POST['email']."', '".$POST['phone']."', '".$POST['title']."', '".$POST['author']."', '".$POST['isbn']."', '".$POST['university']."', '".$POST['condition']."', '".$_POST['price']."')";
$result = mysql_query($query) or die("Query Failed-unable to insert info: ".mysql_error());
if ($result) {
echo "You Textbook and Contact Info Have Been Posted to Bookzella.com Database!<br><br>Thank You.";
}
}
?>
</body>
</html>
that should work out just fine and as you can see from my code compaired to yours you had left out some () with in it and also I insert the fail message should it fail to insert the info into the database and it will give you the exact line that is giving you a problem as well. but remember to build the databse.php file cause this can save you alot of time having to recode your database information each time you need to do a query of some sort.