BoarderLine Posted November 3, 2008 Share Posted November 3, 2008 Hoping someone can help me out with this. I am having trouble entering a value other than 1 from a checked checkbox. As below I have set different values for 4 checkbox's 1,2,4$8 however can not get anything other than value 1 entered into my database for these values??? Can anyone please shed some light? <td class="KT_th"><label for="User">User Account:</label></td> <td><input name="User" type="checkbox" disabled="disabled" id="User" value="1" <?php if (!(strcmp(KT_escapeAttribute($row_rsaccounts['User']),"1"))) {echo "checked=\"checked\"";} ?> /> <?php echo $tNGs->displayFieldError("accounts", "User"); ?> </td> </tr> <tr> <td class="KT_th"><label for="Supplier">Event Supplier:</label></td> <td><input name="Supplier" type="checkbox" disabled="disabled" id="Supplier" value="2" <?php if (!(strcmp(KT_escapeAttribute($row_rsaccounts['Supplier']),"2"))) {echo "checked=\"checked\"";} ?> if /> <?php echo $tNGs->displayFieldError("accounts", "Supplier"); ?> </td> </tr> <tr> <td class="KT_th"><label for="Organizer">Event Advertiser:</label></td> <td><input name="Organizer" type="checkbox" disabled="disabled" id="Organizer" value="4" <?php if (!(strcmp(KT_escapeAttribute($row_rsaccounts['Organizer']),"4"))) {echo "checked=\"4\"";} ?> /> <?php echo $tNGs->displayFieldError("accounts", "Organizer"); ?> </td> </tr> <tr> <td class="KT_th"><label for="Attractions">Attraction Advertiser:</label></td> <td><input name="Attractions" type="checkbox" disabled="disabled" id="Attractions" value="8" <?php if (!(strcmp(KT_escapeAttribute($row_rsaccounts['Attractions']),"8"))) {echo "checked=\"checked\"";} ?> /> <?php echo $tNGs->displayFieldError("accounts", "Attractions"); ?> </td> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/131160-checkbox-value-trouble-from-newbie/ Share on other sites More sharing options...
BoarderLine Posted November 3, 2008 Author Share Posted November 3, 2008 Also for these table values I have the DB Types set to TINYINT(1), unsigned, NULL yes, DEFAULT 0. Quote Link to comment https://forums.phpfreaks.com/topic/131160-checkbox-value-trouble-from-newbie/#findComment-680994 Share on other sites More sharing options...
Adam Posted November 3, 2008 Share Posted November 3, 2008 Try just printing out the value for each on your script, to check if it's a problem with the form or your PHP.. like (can't see form method): print $_GET['User'] . ' / ' . $_GET['Supplier'] . ' / ' . $_GET['Organizer'] . ' / ' . $_GET['Attractions'] . '<br /><br />'; Try just putting that at the top of your script and see what comes out. Also just a quick tip you don't use checked="checked" it's just checked, like: <input type="checkbox" name=".." value=".." checked /> Adam Quote Link to comment https://forums.phpfreaks.com/topic/131160-checkbox-value-trouble-from-newbie/#findComment-681000 Share on other sites More sharing options...
Adam Posted November 3, 2008 Share Posted November 3, 2008 Also, disabling the checkbox will mean the value of the checkboxes aren't being sent.. Quote Link to comment https://forums.phpfreaks.com/topic/131160-checkbox-value-trouble-from-newbie/#findComment-681002 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.