Page 1 of 1

How to align my data???

Posted: Mon Feb 03, 2003 10:46 am
by slipstream
I output it like this:

echo $info[0].' &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ';
echo $info[1].' &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ';
echo $info[2].' &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ';

but instead of &nbsp I want to start my next output at column 30 or whatever, using &nbsp doesn't align it and it looks ugly..

Posted: Mon Feb 03, 2003 10:47 am
by forgun
why u dont try to use the tags html

Code: Select all

<div align="center"></div>
??
is put in the center or what ever u need to put

but

Posted: Mon Feb 03, 2003 10:51 am
by slipstream
all the data is on the same line, I want to have the output like this

info1 info2 info3 info4

nice and even, I can't use a div there, won't work for each piece of data

Posted: Mon Feb 03, 2003 10:58 am
by forgun
so why 3 echos
use one
echo $info[1] .....;
did u try this?

but

Posted: Mon Feb 03, 2003 11:01 am
by slipstream
I did this:

foreach($file as $line)
{
$info = explode('|', $line);

echo " <tr>\n";
echo " <td>" . $info[0] . "</td>";
echo " <td>" . $info[1] . "</td>";
echo " <td>" . $info[2] . "</td>";
echo " <td>" . $info[3] . "</td>";
echo " </tr>\n";

$totHours += $info[2];
}

and it works but the data on each line is too close together, I'd like about 10 spaces between each piece of data, any ideas?

Posted: Mon Feb 03, 2003 11:40 am
by bznutz

Code: Select all

echo "<table name=t1 cellpadding=3 cellspacing=3>";
foreach($file as $line)
&#123;
$info = explode('|', $line);

echo " <tr>\n";
echo " <td>" . $info&#1111;0] . "</td>";
echo " <td>" . $info&#1111;1] . "</td>";
echo " <td>" . $info&#1111;2] . "</td>";
echo " <td>" . $info&#1111;3] . "</td>";
echo " </tr>\n";

$totHours += $info&#1111;2];
&#125;
Notice my edit at the top. If you want some extra space between data cells, just add more padding and/or spacing to the table parameters.

Perfect,

Posted: Mon Feb 03, 2003 12:07 pm
by slipstream
thanks :lol: