0) {
$ret_str="Thank you! Your guestbook entry was successfully added.";
} else {
$ret_str = "Your guestbook entry was NOT successfully added.";
}
// Append success/failure message
$gb_str .= "$ret_str
";
}
?>
";
// While there are still results
while($get_row = mysql_fetch_array($get_rs)) {
$name = $get_row["GuestBookName"];
$email = $get_row["GuestBookEmail"];
$comment = $get_row["GuestBookEntry"];
$ipaddress = $get_row["GuestBookIP"];
$date = $get_row["GuestBookDate"];
if(!empty($name)) {
// If name exists and email exists, link name to email
if(!empty($email)) {
$name="by $name";
}
// If name does exist and email exists, link email to email
} elseif (!empty($email)) {
$name = "by $email";
// Else make name blank
} else {
$name = "";
}
// Append to string we'll print later on
$gb_str .= "
$comment
< posted on $date $name from $ipaddress>
Here is a link to the code for this assignment, in .txt format: guestbook.txt
echo $gb_str; ?>