View Full Version : put 'include' in a table, within an echo, in php

12-02-2005, 06:09 AM
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...
<?php require 'db_connect.php';
if ($logged_in == 1) {echo '
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<td style="width: 150px;">Logged in as '.$_SESSION['username'].'<br><a href="logout.php">logout</a>
<td style="width: 500px;">Test</td>
<td>include "link_ControlPannel.html"</td>

include 'link_ControlPannel.html';

(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.

thank you.

12-27-2005, 04:39 AM
Well in you code you should do i think, is include("Link_ControlPanel.html"); i use a lot include in some other programs and this is the how i used, also i have not seem a code with require like you type include() and require() are php functions so the parameters must be between () like in my example, good look and hope this will help you