<?php
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
?>
<table bgcolor="#D4D0C8" style="border: 1px solid #000000">
<tr>
<td bgcolor="#FFFFFF" style="border: 1px solid #000000">
Rows
</td>
<td bgcolor="#FFFFFF" style="border: 1px solid #000000">
Colums
</td>
<td bgcolor="#FFFFFF" style="border: 1px solid #000000">
Border width
</td>
<td bgcolor="#FFFFFF" style="border: 1px solid #000000">
Border style
</td>
<td bgcolor="#FFFFFF" style="border: 1px solid #000000">
Align
</td>
</tr>
<tr>
<td colspan="5" style="border: 1px solid #000000">
</td>
</tr>
<tr>
<td style="border: 1px solid #000000">
<form method="post" action="">
<select name="rows">
<?php
for ($i=1; $i<=20; $i++) {
echo "\t\t\t\t\t<option value=\"".$i."\">".$i."</option>\n";
}
?>
</select>
</td>
<td style="border: 1px solid #000000">
<select name="colums">
<?php
for ($i=1; $i<=20; $i++) {
echo "\t\t\t\t\t<option value=\"".$i."\">".$i."</option>\n";
}
?>
</select>
</td>
<td style="border: 1px solid #000000">
<select name="bwidth">
<?php
for ($i=0; $i<=10; $i++) {
echo "\t\t\t\t\t<option value=\"".$i."\">".$i."</option>\n";
}
?>
</select>
</td>
<td style="border: 1px solid #000000">
<select name="bstyle">
<option value="solid">Solid</option>
<option value="dashed">Dashed</option>
</select>
</td>
<td style="border: 1px solid #000000">
<select name="align">
<option value="left">Left</option>
<option value="center">Center</option>
<option value="right">Right</option>
</select>
</td>
</tr>
</table>
<br />
<input type="submit" value="Generate!!">
</form>
<?php
}
else {
if (isset($_POST['bwidth']) && $_POST['bwidth'] != 0) {
echo " style=\"border: ".$_POST['bwidth']."px";
if (isset($_POST['bstyle'])) {
echo " ".$_POST['bstyle'];
}
}
if (isset($_POST['align'])) {
echo " align=\"".$_POST['align']."\"";
}
for ($r = 1; $r <= $_POST['rows']; $r++) {
$tr_open = array("<tr>"); $tr_close = array("</tr>");
foreach ($tr_open as $tr_open) {
}
for ($c = 1; $c <= $_POST['colums']; $c++) {
$td_open = array("<td><br /><br />"); $td_close = array("</td>");
foreach ($td_open as $td_open) {
}
foreach ($td_close as $td_close) {
}
}
foreach ($tr_close as $tr_close) {
}
}
}
?>