nested table in php

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
podarum
Forum Commoner
Posts: 51
Joined: Mon Jun 15, 2009 1:36 pm

nested table in php

Post by podarum »

Is there a way I can nest a table into my php code..? for example I have a whole bunch of form variables brought into php and I want to be able to print them in a table , so that I can align them and font them and make them all fancy..
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: nested table in php

Post by Christopher »

Not sure what you mean "nest"? You can do either of these with PHP:

Code: Select all

<?php
echo "<table>
<tr>
<td>$var1</td>
<td>$var2</td>
</tr>
</table>";
?>
<table>
<tr>
<td><?php echo $var1; ?></td>
<td><?php echo $var2; ?></td>
</tr>
</table>
(#10850)
podarum
Forum Commoner
Posts: 51
Joined: Mon Jun 15, 2009 1:36 pm

Re: nested table in php

Post by podarum »

Thank you , this is what I'm looking for.. but what can I insert if I want it to look like this:

The contents of variable1 : Var1
Variable2 is made up of : Var2

Sort of like a 2x2 table?
And is there a way I can make Var1 have a font and Var2 a different font? Thank you.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: nested table in php

Post by Christopher »

You would put things like font attributes into the HTML. Create a style sheet with classes for the table cells. It really has nothing to do with PHP. Look around the web for examples of controlling the font in HTML.
(#10850)
Post Reply