Jump to content

Checkbox value trouble from newbie


BoarderLine

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/131160-checkbox-value-trouble-from-newbie/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.