this is the better guest book, it wouldn't allow me to edit cos i had to edit to much lol well here it is below, same deal
2 files,
1) process.php
2)index.php
//process.php starts here
<?
$username="username";
$password="password";
$database="your_database";
$first=$_POST['first'];
$last=$_POST['last'];
$email=$_POST['email'];
$web=$_POST['web'];
$comment=$_POST['comment'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO guestbook VALUES ('','$first','$last','$email','$web','$comment')";
mysql_query($query);
mysql_close();
?>
//End of Process.php
//start of index.php
<html>
<head>
<title>Guest Book</title>
</head>
<body>
<form action="process.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
E-mail: <input type="text" name="email"><br>
Web: <input type="text" name="web"><br>
Comments: <textarea rows="6" name="comment" cols="27"></textarea>
<input type="Submit">
</form>
</body>
</html>
//end of index.php
//start of view.php
<?
$username="username";
$password="password";
$database="your_database";
mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$row1 = mysql_query("SELECT * FROM guestbook")
while($row=mysql_fetch_array($row1)) {
echo "$row[first_name] $row[last_name] Said<br><hr>";
echo "$row[comments]<br><hr>";
echo "You can view $row[first_name]'s website at $row[www]";
}
?>
//end of view.php
You need to include the \"create table\" call to mySQL because if somebody were to use this it wouldn\'t work. Also, don\'t use the values() function in mySQL. It\'s much better to use something like: set first = \'$first\', last = \'$last\' and so on. This way you can add or remove fields to the table without breaking your code. And finally, it doesn\'t look like you\'ve got a viewer that extracts the information from your db and displays it. This is incomplete.