Checkbox not Posting!

liunx

Guest
This is driving me mad, I have included an extract of my code below (yes it is messy and I am mixing PHP and HTML for speed of development as I am on a tight deadline on this one). <br />
<br />
Basically this is part of an admin page which allows an administrator to edit the details of an intranet user, for some reason when I submit the form the checkbox value is NOT passed on to the next page UNLESS I make a change to either the name or branch. I can't work out why this is as everything else passes fine, it's driving me nuts! <br />
<br />
<br />
<br />
<form name="stage3" method="post" target='_self'> <br />
<p> </p> <br />
<table width="75%" border="0" align="center"> <br />
<tr> <br />
<td width="32%"> </td> <br />
<td width="39%"> </td> <br />
<td width="10%"> </td> <br />
<td width="19%"> </td> <br />
</tr> <br />
<tr> <br />
<td> </td> <br />
<td><div align="center"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><u>EDIT <br />
SALES PERSON</u></strong></font></div></td> <br />
<td> </td> <br />
<td> </td> <br />
</tr> <br />
<tr> <br />
<td> </td> <br />
<td> </td> <br />
<td> </td> <br />
<td> </td> <br />
</tr> <br />
<tr align="center" valign="middle"> <br />
<td> </td> <br />
<td> </td> <br />
<td> </td> <br />
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> </font></td> <br />
</tr> <br />
<tr align="center" valign="middle"> <br />
<td> <div align="right"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>USER <br />
ID:</strong></font></div></td> <br />
<td> <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php echo($userId)?></font></div></td> <br />
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> </font></td> <br />
<td> </td> <br />
</tr> <br />
<tr align="center" valign="middle"> <br />
<td> <div align="right"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>NAME:</strong></font></div></td> <br />
<td> <div align="left"> <br />
<input name="name" type="text" id="name" value="<?php echo($name)?>"> <br />
</div></td> <br />
<td> </td> <br />
<td> </td> <br />
</tr> <br />
<tr align="center" valign="middle"> <br />
<td> <div align="right"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>BRANCH:</strong></font></div></td> <br />
<td> <div align="left"> <br />
<select name="branch" id="branch"><?php <br />
$branchLoop=0; #Loop variable <br />
$getBranches="SELECT * FROM tbl_branch ORDER BY branchName"; <br />
$branchResult=mysql_query($getBranches, $con); <br />
$branchRow=mysql_fetch_assoc($branchResult); <br />
$branchResultNum=mysql_num_rows($branchResult); <br />
for ($branchLoop = $branchResultNum; $branchLoop <> 0; $branchLoop=$branchLoop-1) <br />
{ <br />
if ($branchRow['branchId'] == $branchId) <br />
{ <br />
echo("<option value='".$branchRow['branchId']."' selected>".$branchRow['branchName']."</option>"); <br />
} <br />
else echo("<option value='".$branchRow['branchId']."'>".$branchRow['branchName']."</option>"); <br />
$branchRow=mysql_fetch_assoc($branchResult); <br />
} <br />
?></select> <br />
</div></td> <br />
<td> <div align="center"> <br />
<input type="submit" name="Submit" value="Update"> <br />
</div></td> <br />
<td> </td> <br />
</tr> <br />
<tr> <br />
<td align="center" valign="middle"> <div align="right"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>ACTIVE:</strong></font></div></td> <br />
<td align="center" valign="middle"> <div align="left"> <br />
<input <?php if($active==1) echo("checked")?> name="active" type="checkbox" id="active" value="1"> <br />
</div></td> <br />
<td align="center" valign="middle"><input name="action" type="hidden" id="action" value="update"> <br />
<input name="userId" type="hidden" id="userId" value="<?php echo($userId)?>"></td> <br />
<td> </td> <br />
</tr> <br />
<tr> <br />
<td> </td> <br />
<td><div align="left"> </div></td> <br />
<td> </td> <br />
<td> </td> <br />
</tr> <br />
<tr> <br />
<td> </td> <br />
<td> </td> <br />
<td> </td> <br />
<td> </td> <br />
</tr> <br />
</table> <br />
<p> </p></form> <br />
<br />
<br />
Any help would be great, I know it's probably something stupid! <br />
<br />
Justin.<!--content-->I don't really know anything about PHP but I guess that the problem is in it, so maybe this rather belongs to the server side scripting category?<!--content-->As you will see only a tiny proportion of this is PHP, hence why I posted in the HTML forum...<!--content-->try putting a semicolon after the echo statement? also on the next echo as well?<br />
<br />
or try putting the value into quotes...<br />
$active=="1"<!--content-->
 
Back
Top