View Full Version : if checkbox checked....

10-25-2009, 10:39 AM
Hi. I'm making a website that includes a form, and I kind of hit a bump with the php.

{for($i=0; $i<22; $i++)
{$message.=$i.", ";}}

<tr><td width="425"><input type="checkbox" id="Navs0" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/a_la_carte_p1.jpg" onMouseOver="Nav_but(0, 0)" onMouseOut="Nav_but(1, 0)" onMouseDown="Nav_but(2, 0)" onMouseUp="Nav_but(0, 0)"></td>
<td width="425"><input type="checkbox" id="Navs1" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/artemis_p1.jpg" onMouseOver="Nav_but(0, 1)" onMouseOut="Nav_but(1, 1)" onMouseDown="Nav_but(2, 1)" onMouseUp="Nav_but(0, 1)"></td></tr>
<tr><td width="425"><input type="checkbox" id="Navs2" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/aura_p1.jpg" onMouseOver="Nav_but(0, 2)" onMouseOut="Nav_but(1, 2)" onMouseDown="Nav_but(2, 2)" onMouseUp="Nav_but(0, 2)"></td>
<td width="425"><input type="checkbox" id="Navs3" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/avail_p1.jpg" onMouseOver="Nav_but(0, 3)" onMouseOut="Nav_but(1, 3)" onMouseDown="Nav_but(2, 3)" onMouseUp="Nav_but(0, 3)"></td></tr>
ETC to Navs21
The problem is that the php doesn't "see" if the checkboxes ar checked or not, so that part of $message remains empty...What am I doing wrong? Thank you in advance. Bye.

10-25-2009, 11:39 AM
not really sure what you're trying to do but if you want the form to remember if the checkbox has been checked or not, do this

<input name="chk" type="checkbox" value="" <?php if(isset($_POST['chk'])) { echo 'checked="true"'; } ?> />