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
rawleanoop
Forum Newbie
Posts: 3 Joined: Mon Feb 11, 2008 10:01 am
Post
by rawleanoop » Mon Feb 11, 2008 10:03 am
That's what i'm trying to create.
What I've been able to figure out so far is:
Code: Select all
<html>
<table border="1">
<tr>
<th></th>
<?php
for($i=1; $i<=9;$i++){
echo "<th>", $i, "</th>"; //print the column header
}
?>
</tr>
<?php
for ($i=1; $i<=9; $i++){
echo "<tr>";
echo "<td><i><b>", $i, "</b></i>"; //print the row header
for ($j=1; $j<=9;$j++){
echo "<td>"; $k=$j*$i; echo $k; echo "</td>\n";
}
echo "</tr>\n";
}
?>
</table>
</html>
Any ideas? Please help!
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Mon Feb 11, 2008 10:09 am
You appear to be trying to make a 10 by 10 table rather than 10 separate tables. Is that intentional?
rawleanoop
Forum Newbie
Posts: 3 Joined: Mon Feb 11, 2008 10:01 am
Post
by rawleanoop » Mon Feb 11, 2008 10:12 am
I was able to figure that out. I'm still working on how I would create the tables. I don't want a 10x10 table.
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Mon Feb 11, 2008 10:17 am
Code: Select all
<?php
for ($x = 1; $x < 11; $x++) {
echo "<table style=\"float: left; width: 160px; border: 1px solid #888; margin: 0px 0px 10px 10px;\">";
for ($y = 0; $y < 11; $y++) {
echo "<tr>";
echo "<td style=\"width: 50%\">".$x." * ".$y." =</td>";
echo "<td style=\"width: 50%\">".($x*$y)."</td>";
echo "</tr>";
}
echo "</table>";
}
rawleanoop
Forum Newbie
Posts: 3 Joined: Mon Feb 11, 2008 10:01 am
Post
by rawleanoop » Mon Feb 11, 2008 10:37 am
WOW.
Thank you good sir.