<title>Form in Form: Makes the Trick</title>
<style>
body {background-color: white;}
.border {background-color: black;}
.border tr {background-color: white;}
form {display: inline;}
</style>
<body>
<table cellspacing=1 cellpadding=2 class=border>
<tr>
<th bgcolor=gray></th>
<th>file name</th>
<th>Comments</th>
</tr>
<tr>
<td><input type=checkbox name=filesId value=1 checked></td>
<td>text.txt</td>
<td>
<form action="updComment.php">
<input type=text name=comments value="date missing">
<input type=hidden name=fileId value=1>
</form>
</td>
</tr>
<tr>
<td><input type=checkbox name=filesId value=2 checked></td>
<td>document.doc</td>
<td>
<form action="updComment.php">
<input type=text name=comments value="outdated">
<input type=hidden name=fileId value=2>
</form>
</td>
</tr>
<tr>
<td><input type=checkbox name=filesId value=3></td>
<td>bitmap.bmp</td>
<td>
<form action="updComment.php">
<input type=text name=comments value="Ok.">
<input type=hidden name=fileId value=3>
</form>
</td>
</tr>
</table><br>
<input type=button value="move selected" onclick="alert('I\'ll move file(s): '+showArray(checkStuff(files))); return false;">
<input type=button value="delete selected" onclick="alert('I\'ll delete files: '+showArray(checkStuff(files))); return false;">
</body>
<script>
function checkStuff(what)
{
checkedStuff = new Array();
count = 0;
for(x=0;what[x];x++)
{
if(what[x].checked)
{ checkedStuff[count++] = what[x].value; }
}
return checkedStuff;
}
function showArray(array)
{
they = '';
for(x=0;array[x];x++)
{ they += array[x]+', '; }
return they.substring(0,they.length-2);
//No last comma
}
files = document.getElementsByName('filesId');
</script>