<?php
include ("database.php");
$qry = "Select * from tbnam where $option like '%$content%'";
$result=mysql_query($qry);
while ($row =mysql_fetch_array($result))
{
$id=$row['id'];
?>
//creating table
<tr><?echo "<td><input type=\"checkbox\" name=\"checkbox[]\" id=\"checkbox[]\" value=\"".$row['id']."\" /></td>";?>
<td><? echo $row['name'];?></td>
<td><? echo $row['address'];?></td>
<td><? echo $row['email'];?></td>
<td><? echo $row['telephone'];?></td>
<td><? echo $row['problem'];?></td>
<td><? echo $row['reply_query'];?></td>
<td><? echo $row['type'];?></td>
<td><? echo $row['other'];?></td></tr>
<?php
}
?>
<input type="submit" name="search" value="Print" size="10"/>
</form>
</table>
how i got the checkbox values? any need of passing $id in checkbox[] array ? if yes how it is possible? help me…name=\”checkbox[“\”.$id”\”]\”
By writing
you have designed a form which returns an array of values with each value corresponding to a checkbox that has been “checked”.
In this example the POST variable that points to this array will be $_POST[‘checkbox’]. Since you have set the value of each checkbox as $row[‘id’], each element in the checkbox array will have the ‘id’ value corresponding to each checkbox that you have checked.
You can check out these values like this:
or simply by saying:
Hope this makes it clear. 🙂