i am making a form with dynamically created checkboxes using from my database and some another static checkboxes how to reset the dynamically created checkboxes without affecting the static checkboxes here is my code...
<html>
<head>
<script>
function submit()
{
document.getElementById('form1').submit();
}
</script>
</head>
<body>
<form id="form1"method="get" name="form1">
<?php
mysql_connect('localhost','root','');
mysql_select_db('sample database');
$selectbrand="select brandname from brand group by brandname";
$resultbrand=mysql_query($selectbrand);
while($res=mysql_fetch_array($resultbrand))
{
$brands=$res['brandname'];
?>
<?php echo $brands?>:<input type="checkbox"name="<?php echo $brands?>"id="<?php echo
$brands?>" value="<?php echo $brands?>" onclick="submit();"<?php
if($_GET[$brands]):$ar[]=$_GET[$brands]?>checked="checked" <?php endif;?>><br>
<?php
}?>
<input type="reset" value="clear" name="reset1"value="clear">
<input type="checkbox"name="checkbox1" onclick="submit();" <?php
if($_GET['checkbox1']):?>checked="checked" <?php endif;?>>24 hrs
<input type="checkbox"name="checkbox2" onclick="submit();" <?php
if($_GET['checkbox2']):?>checked="checked" <?php endif;?>>2 days
<input type="checkbox"name="checkbox3" onclick="submit();" <?php
if($_GET['checkbox3']):?>checked="checked" <?php endif;?>>3 days
<input type="reset" name="reset2" value="clear">
</form>
</body>
</html>
<?php
$c=count($ar);
for($i=0;$i<$c;$i++)
{
mysql_connect('localhost','root','');
mysql_select_db('sample database');
$selectquery="select * from brand where brandname='$ar[$i] '";
$result=mysql_query($selectquery);
while($row=mysql_fetch_array($result))
{
$n=$row['brandname'];
echo $n;
}
}
?>