Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.