Problem with Alignment using PHP INCLUDE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
3hhh
Forum Newbie
Posts: 22
Joined: Wed Sep 10, 2008 12:02 pm

Problem with Alignment using PHP INCLUDE

Post by 3hhh »

I have two separate files which I would like to include to my main index page.

buyTickets.php
<table width="200" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><img src="images/buyTickets.jpg" width="200" height="21" /></td>
</tr>
//..... more codes after this removed....
</table>

and

promotions.php

<table width="200" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><img src="images/promotions.jpg" width="200" height="21" /></td>
</tr>
// more codes after this removed....
</table>

I tried to place them one on top of the other in the following line:

index.php
// HTML tags above this line....
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0" class="style1">
<tr>
<td width="210" valign="top"><?php include ("includes/buyTickets.php");?><br /><?php include ("includes/promotions.php");?></td>
// more codes after this removed....

However, it seems like the <br /> is not working well. No matter how many <br /> or <p> I insert between the includes, the alignment just won't work.

Can I include php files in this way? The two files, buyTickets.php and promotions.php do not have the FULL HTML code. They simply contain the <TABLE> .... </TABLE> HTML code. However, my index.php has the FULL HTML code. the <HTML><HEAD> etc are all above the <TABLE....> tag.

I really need some advise on how I can properly include external files. Thanks
User avatar
Dravos
Forum Newbie
Posts: 15
Joined: Wed Sep 10, 2008 9:27 am
Location: London

Re: Problem with Alignment using PHP INCLUDE

Post by Dravos »

Putting them in separate rows should work:

Code: Select all

<table width="980" border="0" align="center" cellpadding="0" cellspacing="0" class="style1">
    <tr>
        <td width="210" valign="top">
            <?php include ("includes/buyTickets.php");?>
        </td>
    </tr>
    <tr>
        <td>
            <?php include ("includes/promotions.php");?>
        </td>
    </tr>
</table>
3hhh
Forum Newbie
Posts: 22
Joined: Wed Sep 10, 2008 12:02 pm

Re: Problem with Alignment using PHP INCLUDE

Post by 3hhh »

Thanks Dravos, you are right. It works fine now :)
Post Reply