Thursday, October 16, 2008

text input dan checkbox html

penjelasannya nanti aja. lagi malesn nih

<pre>
<?
//var_dump($_POST);
$cb = $_POST['cb'];
$tb = $_POST['tb'];
//var_dump($cb);
//var_dump($tb);

if($cb)
foreach($cb as $c)
{
echo $tb[$c]."\n";
}
?>
</pre>

<form method="POST" action="">
<table>
<tr><td><input type="checkbox" name="cb[]" value="0" /></td><td><input
type="text" name="tb[]" value="" /></td></tr>
<tr><td><input type="checkbox" name="cb[]" value="1" /></td><td><input
type="text" name="tb[]" value="" /></td></tr>
<tr><td><input type="checkbox" name="cb[]" value="2" /></td><td><input
type="text" name="tb[]" value="" /></td></tr>
<tr><td><input type="checkbox" name="cb[]" value="3" /></td><td><input
type="text" name="tb[]" value="" /></td></tr>
<tr><td><input type="checkbox" name="cb[]" value="4" /></td><td><input
type="text" name="tb[]" value="" /></td></tr>
<tr><td><input type="checkbox" name="cb[]" value="5" /></td><td><input
type="text" name="tb[]" value="" /></td></tr>


</table>
<input type="submit">
</form>

1 comment: