do it like this:
if($session->logged_in){
echo "<div align=center>Logged in as <br><b>$session->username</div></b>";
}
else
{
$form_block = "put your html here up to the point you have the if statement";
//make sure you escape your quotes in html with \ before every "
//then do this.
$form_block .= "<input type=\"checkbox\" name=\"remember\"";
if ($form->value("rememberme") != "") {
$form_block .= " value=\"ON\"";
}
$form_block .= "></div>
</font></td>
</tr>
</form>";
print $form_block;
}