Codice PHP:
<?php
if ($_REQUEST['id']) {
for ($i=0; $i<3; $i++) {
if ($_POST['check'][$i]) {
$x = $i + 1;
echo "text$x = ".$_POST['text'.$x]."
";
}
}
}
?>
<html>
<head><title></title></head>
<body>
<form id="test" method="post" action="<?=$_SERVER['PHP_SELF']."?id=1"?>">
<input type="checkbox" name="check[]" value="1" />
<input type="text" name="txt1" />
</p>
<input type="checkbox" name="check[]" value="2" />
<input type="text" name="txt2" />
</p>
<input type="checkbox" name="check[]" value="3" />
<input type="text" name="txt3" />
</p>
<input type="submit" value="OK" />
</form>
</body>
</html>