Link to home
Start Free TrialLog in
Avatar of syedasimmeesaq
syedasimmeesaqFlag for United States of America

asked on

Include a file with html formating

I am trying to include a file that has html formating but when I include this to my main php file, it doesn't show any records. What am I doing wrong. Here is the file
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
<?php

// Start the login session
session_start();

if (!$_SESSION['user'] || !$_SESSION['pass']) {

// What to do if the user hasn't logged in
// We'll just redirect them to the login page.
header('Location: login.php');
die();

} else {





 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style3 {font-size: large}
-->
</style>
</head>

<body>
<table width="200" border="2" bordercolor="#80B2E2">
  <tr>
    <td><h1 class="style3">Cose 1</h1></td>
  </tr>
  <tr>
    <td><h1 class="style3">Born 3</h1></td>
  </tr>
  <tr>
    <td><span class="style3">Font 1</span></td>
  </tr>
  <tr>
    <td><span class="style3">Front 21</span></td>
  </tr>
  <tr>
    <td><span class="style3">Prk 16</span></td>
  </tr>
  <tr>
    <td><span class="style3">latte 1</span></td>
  </tr>
  <tr>
    <td><span class="style3">Setwater 1</span></td>
  </tr>
  <tr>
    <td><span class="style3">inta 1</span></td>
  </tr>
  <tr>
    <td><span class="style3">6</span></td>
  </tr>
</table>
</body>
</html>
?>
Thanks
Avatar of nplib
nplib
Flag of Canada image

you can't have html inbetween <?php ?> tags
if you want it to show you have to surround all your html lines with
echo "<html>';

if there are any parts that have " in them then you have to do it like this
echo "<td><span class=\"style3\">6</span></td>"

or place all of your html in a variable and echo that variable at the end.
$html = "<html>";
$html .= "</html>";

echo $html;
ASKER CERTIFIED SOLUTION
Avatar of Joe Wu
Joe Wu
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of syedasimmeesaq

ASKER

I tried this but this didn't work either

<?php

// Start the login session
session_start();

if (!$_SESSION['user'] || !$_SESSION['pass']) {

// What to do if the user hasn't logged in
// We'll just redirect them to the login page.
header('Location: login.php');
die();

} else {





 
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
echo "<title>Untitled Document</title>";
echo "<style type=\"text/css\">";

echo "</head>";

echo "<body>";
echo "<table width=\"200\" border=\"2\" bordercolor=\"#80B2E2\">";
echo  "<tr>";
echo    "<td><h1 class=\"style3\">Conse 1</h1></td>";
echo  "</tr>";
echo  "<tr>";
echo "</body></htm>";

?>

XXXXXXXXXXXXXXXXXXXXXXXXXX

what I am trying to do is to see if the user is loggec in and then show this table

Thanks
darn you I was getting to that.
you style tag isn't closed, that will prevent HTML from showing.
nizsmo: home run  :-)

That worked

Thanks a lot
Glad to be of assistance :)