guys really need your help here.! im working on multiple update using checkbox. since i was using only 1 checkbox before it works fine. but i need 2 values (from checkbox, because if not, array wont give me the value im looking for..) for my query on the next page.

here's the code i got. but it doesn't work when it comes to looping (records from db).
i'll work with hiding the checkbox later.

<?php
if($_POST['submit']!="")
{
echo "che_list: ".$_POST['che_list'];
echo "check_list: ".$_POST['check_list'];
}
?>
<?php include "dbconn.php";?>
	<html>
		<head>
			<SCRIPT LANGUAGE="JavaScript">
			<!-- 

			<!-- Begin
			function Check(chk)
			{
				if(document.myform.Check_ctr.checked==true)
				{
					for (i = 0; i < chk.length; i++)
					chk[i].checked = true ;
				}
				else
				{
					for (i = 0; i < chk.length; i++)
					chk[i].checked = false ;
				}
			}

			// End -->
			</script>
		</head>
		<body>
			<form name="myform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
				<table>
					<tr>
						<td><input type="checkbox" name="Check_ctr" value="yes"	onClick="Check(document.myform)"/></td>
						<td><input type="checkbox" name="che_list" value="1">ASP</td>
						<td><input type="checkbox" name="check_list" value="2">PHP</td>
					</tr>
					<tr>
						<td><input type="submit" name="submit" value="Submit"/></td>
					</tr>
				</table>
			</form>
		</body>
	</html>

pls help. its the only thing i cant do on my module.
thanx a lot.

guys.. this is what i want to work on.. but i dont know what to do with the javascript..
Check_ctr will be the control for the two hidden checkbox..

really needed ur help. thanx

<?php
if($_POST['submit']!="")
{
echo "subject: ".$_POST['asp'];
echo "subject_id: ".$_POST['asp_id];

echo "subject: ".$_POST['php'];
echo "subject_id: ".$_POST['php_id];
}
?>
<?php include "dbconn.php";?>
	<html>
		<head>
			<SCRIPT LANGUAGE="JavaScript">
			<!-- 

			<!-- Begin
			function Check(chk)
			{
			
					if(document.myform.Check_ctr.checked==true)
					{
						for (i = 0; i < chk.length; i++)
						chk[i].checked = true ;
					}
					else
					{
						for (i = 0; i < chk.length; i++)
						chk[i].checked = false ;
					}
					
			}

			// End -->
			</script>
			<style type="text/css">
				.divMain{visibility: hidden}				
			</style>
		</head>
		<body>
			<form name="myform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
				<div>
					<div>
						<div><input type="checkbox" name="Check_ctr" value="yes" onClick="Check(document.myform)"/></div>
						<div class="divMain"><input type="checkbox" name="asp" value="asp">ASP</div>
						<div class="divMain"><input type="checkbox" name="asp_id" value="1">asp_id</div>
					</div>
					<div>
						<div><input type="checkbox" name="Check_ctr" value="yes" onClick="Check(document.myform)"/></div>
						<div class="divMain"><input type="checkbox" name="php" value="php">PHP</div>
						<div class="divMain"><input type="checkbox" name="php_id" value="2">php_id</div>
					</div>
					<div>
						<div><input type="submit" name="submit" value="Submit"/></div>
					</div>
				</div>
			</form>
		</body>
	</html>
This article has been dead for over six months. Start a new discussion instead.