View Single Post
Old 12-02-2005, 05:09 AM   #1
jmiter
Green Mole
 
Join Date: Dec 2005
Posts: 1
put 'include' in a table, within an echo, in php

Hoping for some assistance with some coding...

I would like to place an include command, into a table cell, that is with in an echo statement, with the <?php ?> area.

Here is a code snip, then I'll explain why I'm doing this...
---snip---
<?php require 'db_connect.php';
if ($logged_in == 1) {echo '
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 150px;">Logged in as '.$_SESSION['username'].'<br><a href="logout.php">logout</a>
</td>
<td style="width: 500px;">Test</td>
<td></td>
</tr>
<tr>
<td>include "link_ControlPannel.html"</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>';

include 'link_ControlPannel.html';

}
---snip-end---
(please note, I'm not a programer - more of a coding hobbist. So I realize that my methods may not be polished.)

All of my code is with in the <?php ?> to prevent users from accessing the page if not logged in. I've been able to use tables, with borders at 0 or 1, to make the allignment of items on my page clean.

I would like to place the "include 'link_ControlPannel.html'" within the <td><?td>, as shown above, but cannot seem to get the include to actually display the code. Rather the statement "include 'link_ControlPannel.html'" is shown as text within the cell.

Only with the second include, show here as an example, is the code displayed properly (all the links). See attached pdf for how the page looks now. I woulld like to get the Control Pannel into the cell where you currently see the include statement.

anyone?
thank you.
Attached Files
File Type: pdf IncludeHelp.pdf (3.4 KB, 3 views)
jmiter is offline   Reply With Quote