hi all,
it's my code ,i want to display check box and two drop down list in a table ,
user can choose which one check box and set some value from drop down list ,
then i want send the row that user selected and these settings values from drop down list, but it's will send all rows drop down list value (not only check box checked)
any one knows how to modify ?
<?
$sql="select id , name, email from user ;";
$result = mysql_query($sql);
if (!$result) {
die("Query to show fields from table failed");
}
$result_num = mysql_num_rows($result);
echo "<form name=\"myForm\" action=\"recv.php\" method=\"POST\">
<table border=1>
<tr bgcolor=#C0C0C0>
<td><center></center></td>
<td><center>Name</center></td>
<td><center>email</center></td>
<td><center>type</center></td>
<td><center>price</center></td>
</tr> ";
if ($result_num==0){
$this->error = $sql;
return false;
}else{
for ($i=0;$i<$result_num;$i++){
echo "<tr>";
$row = mysql_fetch_array($result);
$uid = $row['id '];
$name = $row['name'];
$email = $row['email '];
$ type = ' type_'.$uid;
$ckd = 'ckd_'.$i;
$price= 'price_'.$uid;
if($i==0) echo "<input type=\"checkbox\" name =\"$ckd\" id=\"$ckd\" value=\"$uid\" Checked onClick=\"chooseOne(this);\">";
else echo "<input type=\"checkbox\" name =\"$ckd\" id=\"$ckd\" value=\"$uid\" onClick=\"chooseOne(this);\">";
echo "<td>$name</td>";
echo "<td>$email</td>";
echo "<td><select name=\"$ type \" >
<option value=\"1\">modelA </option>
<option value=\"2\">modelA </option>
</select></td>";
echo "<td><select name=\"$price\" >
<option value='1' >low</option>
<option value='2'>high</option>
</select></td>";
echo "</tr>\n";
}
<input value=\"Test\" type=\"submit\" onclick=\"this.disabled=true ; \" >
echo "</table>";
echo "</form>";
}
?>
html result img :
http://img256.imageshack.us/img256/474/nonamesq.jpg