If anyone can assist me I would appreciate it. I have been trying to make this work for the past 3 days. I am doing a simple guestbook with PHP into MySQl and it connects, the ID and Date stamps work and appear in the guestbook but the name, email, hometown and comments do not. Here is the code. Again thank you in advance for any assistance.
<body bgcolor="#000000">
<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name="guestbook"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect server");
mysql_select_db("$db_name")or die("cannot select DB");
$date=date("y-m-d"); //date
$sql="INSERT INTO $tbl_name(name, email, hometown, comments, date)VALUES('$name','$email','$hometown','$comments','$date')";
$result=mysql_query($sql);
//check if query successful
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='viewguestbook.php'>View guestbook</a>"; // link to view guestbook page
}
else {
echo "ERROR";
}
mysql_close();
?>