Guestbook modification problem

I’m new to this but I was trying to modify Guestbook to automatically input the user’s name and email address from a log in program to access the site.

I am trying to use SESSION variables but they will not input into the form.

Can anyone help?

Here is my code.

<?php

session_start();

require_once(“dbcon.php”);

$form = “<table>
<form action=‘login.php’ method=‘post’>
<tr>
<td>Username: </td><td><input type=‘text’ name=‘user’ size=‘20’ />
</tr>
<tr>
<td>Email: </td><td><input type=‘text’ name=‘emad’ size=‘30’ />
</tr>
<tr>
<td><input type=‘submit’ name=‘submit’ value=‘Login’ />
<td><a href=‘New Contact.html’>New Account </a>
</tr>
</form>
</table>”; // Do NOT use \" when you still have the option to use singlequotes, looks so messy…

$user = $_POST[‘user’];
$emad = $_POST[‘emad’]; //defining these in the start makes the source looks nicer

if(!$_POST[‘submit’]) die($form); // just kill the rest of the script if the form isn’t submitted.
if(!$user || !$emad) die(“Required fields missing<br /><br /> $form”); // killing the rest of the script and echoing the form and error

$sql = "SELECT ident FROM Mix WHERE password = '$pass' AND username = '$user'"; // just like with the variables and prints/echoes, you don't need to ".$var." anything with double quotemarks
$res = mysql_query($sql) or die(mysql_error()); 
if(mysql_num_rows($res) &gt; 0) { 
    $row = mysql_fetch_assoc($res); 

$_SESSION[‘uid’] = $row[‘id’];
$_SESSION[‘un’] = $_POST[‘user’]; //Setup user name into session variable.
$_SESSION[‘ua’] = $_POST[‘emad’]; //Setup email address into session variable.
echo “You have been logged in as $user at $emad. Click <a href=\“gbook.php\”>here</a> to the member page.”;
} else {
echo “That username/password combination doesn’t exist!<br /><br/> $form”;
}

?>

Below is a copy of the Sign Form. php. I am trying to populate teh Name and email fields but the SESSION variables don’t show up. Can someone figure out what I AM DOING WRONG.

<?php session_start ();
$un = $_SESSION[‘un’];
$ua = $_SESSION[‘ua’];
?>

<div id=“gbook_guestbook” align=“center”>
<span class=“gbook_guestbook”><?php echo $lang[‘t48’]; ?></span><br class=“clear” />
<span class=“gbook_required”><?php echo $lang[‘t49’]; ?></span>
</div>

<form action=“gbook.php” method=“post”>
<!–SIGN FORM –>
<div id=“gbook_entries”>

<?php
if ($error)
{
echo ‘<div class=“gbook_sign_error”>’.$error.‘</div>’;
}
?>

<div class=“gbook_left”><span class=“gbook_entries”><b><?php echo $lang[‘t50’]; ?></b></span></div>
<div class=“gbook_right”><input type=“hidden” name=“<?php echo $myfield[‘name’]; ?>” value=“<?php echo $un; ?>” /></div> <?php echo $un; ?>

<div class=“clear”></div>

<div class=“gbook_left”><span class=“gbook_entries”><?php echo $lang[‘t51’]; ?></span></div>
<div class=“gbook_right”><input type=“text” name=“from” value=“<?php echo $from; ?>” size=“45” /></div>

<div class=“clear”></div>

<?php
if ($settings[‘use_url’])
{
?>
<div class=“gbook_left”><span class=“gbook_entries”><?php echo $lang[‘t53’]; ?></span></div>
<div class=“gbook_right”><input type=“text” name=“url” value=“<?php echo $url; ?>” size=“45” maxlength=“80” /></div>

  &lt;div class="clear"&gt;&lt;/div&gt;
   &lt;?php

}
?>

<div class=“gbook_left”><span class=“gbook_entries”><?php echo $lang[‘t52’]; ?></span></div>
<div class=“gbook_right”><input type=“hidden” name=“email” value=“<?php echo $ua; ?>” /> <?php echo $ua; ?>
<?php
if ($settings[‘hide_emails’])
{
?>
<br class=“clear” /><span class=“gbook_entries”><i><?php echo $lang[‘t66’]; ?></i></span>
<?php
}
?>
</div>

<div class=“clear”></div>

<div class=“gbook_left”><span class=“gbook_entries”><b><?php echo $lang[‘t16’]; ?></b></span></div>
<div class=“gbook_right”><span class=“gbook_entries”><i><?php echo $lang[‘t54’]; ?></i></span></div>