table in php?
Moderator: General Moderators
-
sarjanajava
- Forum Newbie
- Posts: 3
- Joined: Mon Dec 02, 2002 10:29 am
table in php?
How to create a table in PHP . I saw so many website using a fancy and very attractive color for tables, especially this forum
To do a table completely in PHP you have to escape out certain characters. For Example
Or you just do a mix like me. I just
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.
Code: Select all
<?phpecho "<table width="100%" border="0" cellpadding="4" cellspacing="0">"
?>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.
?>As for the colors use a cascade stylesheet for that.
- cheatboy00
- Forum Contributor
- Posts: 151
- Joined: Sat Jun 29, 2002 10:36 am
- Location: canada
- Contact:
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...
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).
Code: Select all
<?php
echo "<table border="1" bgcolor="#FFFFFF">\r\n";
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
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
For more info on CSS: http://www.w3schools.com/css/default.asp
Mac