If test1 is a name:
$test1 = $_POST['test1']; //will give 'yes' or 'no'
If you don't know the 'key' for the 'test' it's going to be difficult. Perhaps placing an actual key would be possible:
... name = "test['$rowId']" ...
as an attribute.
Then in your form handling:
$arr = $_POST['test'];
$sqlkeyvalue = "";
foreach($arr as $key=>$value){
if($value == 'yes'){
$sqlval = 1;
}else{
$sqlval = 0;
}
$sqlkeyvalue .= ",`field{$key}` = $sqlvalue";
}
$sql = mysql_query("INSERT INTO table1 SET " . substr($sqlkeyvalue,0,-1) WHERE ...");
I haven't tried this so I can't say if it's even possible, but I think it's pretty close.
diafol
Rhod Gilbert Fan (ardav)
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080