Hi
I have a form which contains 4 select boxes (amongst the usual input types)
Here's an example
<div class="formElement"><p class="formText">Are you a tenant:</p><input class="checkbox" type="checkbox" name="resid[0]" value="is-tenant" /><div class="clearer"></div></div>
<div class="formElement"><p class="formText">Are you a landlord:</p><input class="checkbox" type="checkbox" name="resid[1]" value="is-landlord" /><div class="clearer"></div></div>
Now, I want to make these stick so that they are checked if the user presses submit, but forgets to fill in say their name etc
Here's what I tried
<div class="formElement"><p class="formText">Are you on benefits:</p><input class="checkbox" type="checkbox" name="resid[0]" value="is-on-benefits" <?php if ($_POST["resid[0]"]=="is-on-benefits" ){ echo 'checked="yes" ';} ?>/><div class="clearer"></div></div>
which didn't work...
along with
<div class="formElement"><p class="formText">Are you on benefits:</p><input class="checkbox" type="checkbox" name="resid[0]" value="is-on-benefits" <?php if ((isset($_POST["resid[0]"]) ){ echo 'checked="yes" ';} ?>/><div class="clearer"></div></div>
and putting !empty instead of isset.
I guess I am doing something wrong?
Can anyone help please
Thanks
Edward