I have a guest book but when it completes, only the username and message part works (updates to database) however $yourname var dosn't get put into the table "name" on the database and think its this page because if I manually add a name in the table it shows up on the guest book view page,

any ideas please anyone, i have tried all kinds to no avail.
PS yes I am logged in, and not sure why it dosn't work as it should as the message gets in there along with the users name ($username) who the guestbook is for.

PHP Code:

<title>J~Net Guestbook</title>
<link rel="stylesheet" type="text/css" href="../css/style.css" />

require 'database.php';
// include '../header.php';

$id $_SESSION['user_id'];
$_SESSION['user_id']= $id;
$yourname $_SESSION['user_name'];
$_SESSION['user_name']= $yourname;
// $_SESSION['user_name'] = $full_name;
$_SESSION['user_level'] = $user_level;
$_SESSION['session_name'] = $user_name;
$_SESSION['balance']= $balance;
// Connects to your Database 
mysql_connect("localhost""root""") or die(mysql_error()); 
mysql_select_db("messages") or die(mysql_error()); 
$data mysql_query("SELECT * FROM users where id = $id"
 or die(
$info mysql_fetch_array$data )) 

" <td>".$info['user_name'] . "</td> "
$username $_SESSION['visited_profile'];
$yourname $info["user_name"];
$message strip_tags($_POST['message']);

if (isset(
        if (!
"<P><center>Please Enter A Message!";
"<FORM><INPUT TYPE='button' VALUE='Go back' onClick='history.go(-1);return true;'> </FORM>";
$query mysql_query("INSERT INTO guestbook (username, message, name) VALUES ('$username','$message','$yourname')") or die(mysql_error());

"<center>Your Message Was Posted Sucsessfuly!<br /><a href='guestbook.php?" $_SESSION['visited_profile'] . "'>Continue</a></center>";