<td>FooterMenu</td>
      <td><input  type="checkbox" name="FooterMenu" value="1"
        <?php if($FooterMenu == 1): ?> checked="checked" <?php elseif($FooterMenu != 1):?> checked="unchecked" <?php endif;?>/>        
    </td>

Dani AI

Generated

Quick diagnosis: the checkbox must be marked by the presence of the HTML boolean attribute checked — not by setting it to "unchecked" or by printing an empty checked="". 's markup ends up emitting an invalid/meaningless value, and 's suggestion (which prints checked="" when false) still leaves the attribute present, so the box will appear checked. Also note that PHP's alternative if: ... endif; syntax is perfectly valid in templates; the real issue here is whether the checked attribute is emitted at all.

A simple, robust pattern is to emit checked only when the database value equals 1, and to include a hidden input so you always get a value when the box is unchecked:

<input type="hidden" name="FooterMenu" value="0" />

<input type="checkbox" name="FooterMenu" value="1" <?php if ((int)$FooterMenu === 1) echo 'checked'; ?> />

When processing the form, coerce the incoming value to a 0/1 flag before saving:

$FooterMenu = isset($_POST['FooterMenu']) ? 1 : 0;
// or if reading DB:
$FooterMenu = (int)$row['FooterMenu'];

Troubleshooting tips: view the page source to confirm whether checked is present, use var_dump($FooterMenu) to verify its type/value, and prefer strict comparison (===) so strings like "1" or other truthy values don't cause surprises. If you need a cleaner template, build the attribute into a variable first ($checked = ((int)$FooterMenu === 1) ? 'checked' : '';) and echo that inside the input.

You shouldn't have a colon after the if queries and you aren't using braces. I'm also pretty certain that the value for a box to be unchecked is actually just blank, not "unchecked". I suggest trying this:

<td>FooterMenu</td>
<td><input type="checkbox" name="FooterMenu" value="1" checked="<?php if($FooterMenu == 1){echo "checked";}else{echo "";} ?>" /></td>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.