问题
I have a checkbox and it is not being sent to the call back page using POST. I've read that it needs a value, and I supplied that, but am not sure what else could be wrong. Here's the checkbox code I am currently using. Smarty is being used here.
{foreach from=$all_splash_carriers item=item}
<tr>
<td class="evp">{$item.carrier}:</td>
<td><input name="{$item.splash_carriers_id}.splashcarrier.{$item.carrier_id}" value="{$item.url}"/><input type="checkbox" name="{$item.carrier_id}.checkbox" value="1" {if $item.activated == '1'}checked{/if}/>Activated</td>
<tr>
{/foreach}
回答1:
The checkbox is not sent if it is not checked.
Also, PHP silently converts any dots in names to underscores, because otherwise the "register_globals" mode would render inaccessible global variables.
回答2:
if $item.activated == '1'
should be
if ($item.activated == '1')
来源:https://stackoverflow.com/questions/15753677/checkbox-not-being-sent-in-post-using-php