I need some help about how to combine these two html codes, to make table based checkbox forms. Code2 display a mysql query result. I don't know where to put the table tr and td codes to be able to work correctly.
Code1:
<?php
header('Content-type: text/html; charset=UTF-8');
echo "<!DOCTYPE HTML>";
echo "<html>";
echo "<head>";
echo '<form action="testing.php" method="post">';
echo '<input type="checkbox" name="dtest" value="row0fromsqlresult">aaa<br>';
echo '<input type="checkbox" name="dtest" value="row1fromsqlresult">bbb<br>';
echo '<input type="checkbox" name="dtest" value="row2fromsqlresult">ccc<br>';
echo '<input type="checkbox" name="dtest" value="row3fromsqlresult">ddd<br>';
echo '<input type="checkbox" name="dtest" value="row4fromsqlresult">eee<br>';
echo '<input type="checkbox" name="dtest" value="row5fromsqlresult">fff<br>';
echo '<button type="submit">Submit</button>';
echo '</form>';
echo '</body>';
echo '</html>';
?>
with this:
Code2:
<?php
echo "<table width='90%' border='1'>";
while ( false!=($row=mysql_fetch_assoc($sqlresult)) ) {
echo '
<tr>
<td><a href="getdetail.php?id=', urlencode($row['row0']), '">',
htmlspecialchars($row['row1']),
'</td>
<td>', htmlspecialchars($row['row2']), '</td>
<td>', htmlspecialchars($row['row3']), '</td>
<td>', htmlspecialchars($row['row4']), '</td>
<td>', htmlspecialchars($row['row5']), '</td>
</tr>
';
}
echo '</table>';
?>
What I would like is an checkbox infront of each sql result line.
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire