MySQL 4.0.18
PHP 5
Apache - lepo podesen (ispravljen httpd file)
MySQL - lepo podesen (obrisan 0 korisnik, napravljen admin sa passwordom...)
PHP 5 - lepo podesen (iskopirani oni fajlovi, i to...)
Napravio sam bazu books.sql
Napravio sam neophodne tabele.
I samo sam hteo da primer proradi, tj. putem html forme dodam knjigu.
A on nece.
Zato molim za pomoc.
Evo fajlova.
insert_book.php
<html>
<head>
<title>Book-O-Rama Book Entry Results</title>
</head>
<body>
<h1>Book-O-Rama Book Entry Results</h1>
<?php
// create short variable names
$isbn=$HTTP_POST_VARS['isbn'];
$author=$HTTP_POST_VARS['author'];
$title=$HTTP_POST_VARS['title'];
$price=$HTTP_POST_VARS['price'];
if (!$isbn || !$author || !$title || !$price)
{
echo 'You have not entered all the required details.<br />'
.'Please go back and try again.';
exit;
}
$isbn = addslashes($isbn);
$author = addslashes($author);
$title = addslashes($title);
$price = doubleval($price);
@ $db = mysql_pconnect('localhost', 'bookorama', 'bookorama123');
if (!$db)
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
mysql_select_db('books');
$query = "insert into books values
('".$isbn."', '".$author."', '".$title."', '".$price."')";
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows().' book inserted into database.';
?>
</body>
</html>
newbook.html
<html>
<head>
<title>Book-O-Rama - New Book Entry</title>
</head>
<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>
Posto kliknem na submit ne desi se nista. Pojavi se samo velikim crnim slovima bookorama book entry results. A ispod nista.
Gde gresim????
P.S.: Ovom falu newbook.html pristupam ovako:
http://localhost/newbook.html