Page 1 of 1
table in php?
Posted: Mon Dec 02, 2002 10:29 am
by sarjanajava
How to create a table in PHP . I saw so many website using a fancy and very attractive color for tables, especially this forum
Posted: Mon Dec 02, 2002 10:57 am
by oldtimer
To do a table completely in PHP you have to escape out certain characters. For Example
Code: Select all
<?phpecho "<table width="100%" border="0" cellpadding="4" cellspacing="0">"
?>
Or you just do a mix like me. I just
Code: Select all
<?php
// your php code here.
?>
<table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><? echo $user; ?></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<?
// the rest of your stuff here.
?>
Now the advantages of straight php is that you use less <? or ?>. But as I am still learning i forget to escape out characters.
As for the colors use a cascade stylesheet for that.
Posted: Mon Dec 02, 2002 1:46 pm
by cheatboy00
I create my tables in the php code, using echos and such, I find it eaiser. Though if you do ti this way, and you view the source than you'll see all the html in one line... which can be brutal to sort through unless you do this...
Code: Select all
<?php
echo "<table border="1" bgcolor="#FFFFFF">\r\n";
?>
Note the \r\n that basicly means new line. if you dont want your html to be on one line just add this at the end of each echo(or if you want you can use print).
Posted: Tue Dec 03, 2002 6:37 am
by twigletmac
If you want to change the colors of the tables then this is CSS and HTML attibutes not PHP.
For more info on CSS:
http://www.w3schools.com/css/default.asp
Mac