randydg Posted September 26, 2009 Share Posted September 26, 2009 I need a way to determin if the box is supose to be checked it will check it. the code I have bellow just puts the word check under the box instead of actualy checking the box. <td width="69"><span class="style4">Priority:</span> <input name="priority" type="checkbox" id="priority" value="1"> <?php // get Current pri value $db = mysql_connect("ip","user","pass") or die("Couldn't connect"); mysql_select_db("database",$db) or die("Couldn't select database"); $query="SELECT `priority` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $priority=mysql_result($result,$i,"priority"); $i++; }; if ( $priority == 1 ) { echo "checked "; } else // do nothing ?> Quote Link to comment https://forums.phpfreaks.com/topic/175652-solved-code-that-will-check-a-form-box-help/ Share on other sites More sharing options...
Alex Posted September 26, 2009 Share Posted September 26, 2009 <?php // get Current pri value $db = mysql_connect("ip","user","pass") or die("Couldn't connect"); mysql_select_db("database",$db) or die("Couldn't select database"); $query="SELECT `priority` FROM `calls` WHERE `worksheet` = '$worksheetnum'"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $priority=mysql_result($result,$i,"priority"); $i++; }; $checked = ($priority == 1) ? 'checked="checked"' : NULL; echo '<input name="priority" type="checkbox" id="priority" value="1" ' . $checked . '>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/175652-solved-code-that-will-check-a-form-box-help/#findComment-925571 Share on other sites More sharing options...
randydg Posted September 26, 2009 Author Share Posted September 26, 2009 if you dont want to help people then just go some where else. there is no need for your attitude. it is uncalled for. Quote Link to comment https://forums.phpfreaks.com/topic/175652-solved-code-that-will-check-a-form-box-help/#findComment-925573 Share on other sites More sharing options...
knsito Posted September 26, 2009 Share Posted September 26, 2009 afaik He did what you wanted. Take a breath and look again. if you dont want to help people then just go some where else. there is no need for your attitude. it is uncalled for. Quote Link to comment https://forums.phpfreaks.com/topic/175652-solved-code-that-will-check-a-form-box-help/#findComment-925575 Share on other sites More sharing options...
ASPF430 Posted September 26, 2009 Share Posted September 26, 2009 if you dont want to help people then just go some where else. there is no need for your attitude. it is uncalled for. Bottom part - its fixed? I'd take that back! Quote Link to comment https://forums.phpfreaks.com/topic/175652-solved-code-that-will-check-a-form-box-help/#findComment-925576 Share on other sites More sharing options...
randydg Posted September 28, 2009 Author Share Posted September 28, 2009 I am sooo sorry, all i saw was the get a life thing i thought the top part was what i pasted. I am very sorry Quote Link to comment https://forums.phpfreaks.com/topic/175652-solved-code-that-will-check-a-form-box-help/#findComment-926354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.