cartesianbeef Posted June 27, 2009 Share Posted June 27, 2009 hello, I've got a problem regarding checkboxes. What I want is that when a page loads is certain checkboxes to be automatically disabled if their value is stored in the database. Here is a snippet... echo("</tr>"); echo("</table>"); $reds = array('1','3','5','7','9','12','14','16','18','19','21','23','25','27','30','32','34','36', '38', '40', '42', '44', '46', '48', '50'); echo('<script language="javascript" src="'.$BASEURL.'/js/xxxx.js"></script>'); echo('<script language="javascript" src="'.$BASEURL.'/js/xxxx.js"></script>'); echo ("<table width=90% cellspacing=0 cellpadding=3><br>"); tr2('align=center class=colhead colspan=4','xxxxxx'); echo("<tr>"); echo('<tr><td>'); echo('<br>'); echo('<center><b><a href="xxxxxxxxl.php" id="payouts" rel="payoutcontent">Click Here For Info!</a></b></center>'); echo('<div id="payoutcontent" style="position:absolute; visibility: hidden; border: 1px solid black; background-color: grey; width: 150px; height: 150px; padding: 4px;">'); echo(' <div style="width: 100%; float: left"> <b>blaa blaa blaa.</b> </div> </div> <script type="text/javascript"> dropdowncontent.init("payouts", "bottom-right", 100, "click") </script> '); echo('<table width="30%" border="0" cellspacing="0" cellpadding="0" align="center">'); $i = 1; $newtr = array('3','6','9','12','15','18','21','24','27','30','33','36', '39', '42', '45', '48'); do { if (in_array($i,$reds)){ echo('<td style="background:#FF0000;color:#FFFFFF"><input type=checkbox name=mynums[] id="check'.$i.'" value='.$i.'>'); echo($i."</td>"); }else{ echo('<td style="background:#000000;color:#FFFFFF"><input type=checkbox name=mynums[] id="check'.$i.'"'.$disable.' value='.$i.'>'); echo($i."</td>"); } if (in_array($i,$newtr)==true){ echo('</tr><tr>'); } $i=$i+1; } while ($i < 52); echo('</tr></table>'); echo('<tr><td>'); echo('</td></tr><tr><td>'); echo('<br>'); every time a box is checked and the form submitted that value goes into a DB table, so I want that box to be disabled next time the form loads... Any help you give would be greatly appreciated Link to comment https://forums.phpfreaks.com/topic/163877-checkbox-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.