Browser cuts off the code

Hello everybody:)
I am new here so please be gentle;) I am doing a website with login option and it all works perfectly unless I combine the php with the html on one page… When I do it, everything belowsome point in the code is just invisible but when I do it in the Dreamweaver, it all shows fine in the design mode. When I looked at the source code of the website in the browser i noticed something strange: the browser cuts off about a half of my code.
This is the code:

<body>

<div class="container">

<div class="header">
<img src="../social.jpg" width="145" height="56" alt="&quot;&quot;" align="right" />
<!-- end .header --></div>
  <div class="content">
    <div style="width:940px;height:auto;-webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px;border:3px solid #000000;background-color:#FFFFFF;padding:10px;">

<table>
<tr><td>


<?php
/**
 * User has already logged in, so display relavent links, including
 * a link to the admin center if the user is an administrator.
 */
if($session->logged_in){
   echo "<h1>Logged In</h1>";
   echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
       ."[<a href=\\"userinfo.php?user=$session->username\\">My Account</a>] &nbsp;&nbsp;"
       ."[<a href=\\"useredit.php\\">Edit Account</a>] &nbsp;&nbsp;";
   if($session->isAdmin()){
      echo "[<a href=\\"admin/admin.php\\">Admin Center</a>] &nbsp;&nbsp;";
   }
   echo "[<a href=\\"process.php\\">Logout</a>]";
}
else{
?>
<?php

if($form->num_errors > 0){
   echo "<font size=\\"2\\" color=\\"#ff0000\\">".$form->num_errors." error(s) found</font>";
}
?>

<form action="process.php" method="post">
<tr><td>Username:

This is the point where the browser cuts the code off.

</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
</table>
</form>

<?php
}


echo "</td></tr><tr><td align=\\"center\\"><br><br>";
echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.<br><br>";

include("include/view_active.php");

?>


</td></tr>
</table>



      <!-- end .content --></p>
      <p>&nbsp;</p>
    </div>
  </div>
  <div class="footer"> <div class="content">
    <div style="width:960px;height:auto;-webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px;border:3px solid #000000;background-color:#FFFFFF;">
      <center><p>Our partners:<br />

      </p></center>
      <p><center><a href="http://www.fitnessworld.dk"><img src="../fitmessworld.jpg" alt="Fitness World" width="161" height="60" border="0"/></a><a href="../www.fitness.dk"><img src="../fitnessdk.jpg" alt="fitness.dk" width="109" height="60" border="0" /></a><img src="../stadium.jpg" alt="stadium" width="191" height="65" /><a href="../www.sunset-boulevard.dk"><img src="../sunsetboulevard.jpg" alt="Sunset Boulevard" width="92" height="60" /></a>
      </center></p>
    </div>
    <p><!-- end .footer --></p>
  </div>
  <!-- end .container --></div>
  </div>
</ body>

Please guys, help me out because I’m really desperate at this point… Thank you in advance.

Use error_reporting and it will show you have some issues…

Ok, but how to do it correctly? I see there are a lot of ways and every website tells something different. I haven’t done error_reporting before so please tell me how should it look like and what should show up and where when I do it correctly.

http://www.php.net/manual/en/function.error-reporting.php

This is an example using your code from above:


<?php error_reporting(E_ALL); ?>
<body>
    <div class="container">

Which showed me some notices, but gave me a fatal error:

<b>Fatal error</b>:  Call to a member function value() on a non-object in <b>Untitled.php</b> on line <b>45</b><br />

Added indents to see the error clearer


<tr>
	<td>Username:</td>
	<td>
/* Line 45  */	<input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>">
	</td>
	<td><? echo $form->error("user"); ?></td>
</tr>

Of course I am going by the code given, which doesn’t show an include or require until include(“include/view_active.php”); or any other code that is above the <body> tag.

I suspect that below that point you have used PHP short tags, is that the reason? Try using PHP full tag <?PHP… ?> instead of <?..?>. As suggested above, use always error reporting ON and all on top of the page.


error_reporting(E_ALL);
ini_set('display_errors', 1);
// php codes go here....