hi, im enim and its my first time to post here in javascript because im into php.

my question is:

1.) Is it possible to have two checkbox in a row (with different value), the one is hidden and if i check the the visible checkbox, the other one will be checked too..


2.) and the scenario above will be in an array like when i have 10 rows..

pls. anyone really need your help thanks

can you be more clear about it ???????

this is what im talking about.. its just a single row.. i need to use it in array (for example 10 rows) but it doesn't work. i know i need some javascript add'l code but i don't know how to continue.

the controller will be the visible..the other two checkbox will be hidden.

<?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">
				<div>	
					<div style="width: 200px; height: 30px"><input type="checkbox" name="Check_ctr" value="yes" onClick="Check(document.myform)"/>controller</div>
					<div style="width: 200px; height: 30px">
						<div style="float: left"><input type="checkbox" name="providername" value="premium"/></div>
						<div style="float: left"><input type="checkbox" name="id" value="2"/></div>
					</div>
					<div style="width: 200px; height: 30px">
						<div><input type="submit" name="submit" value="Submit"/></div>
					</div>
				</div>
			</form>
		</body>
	</html>

thanks in advance.
-enim

hey guys, i think i just dont know how to expalin my problem.. but its ok now. i have it solved myself. i will post the code just in case someboby need it.

//records from database
$i = 0;
while($row = mysql_fetch_array($result))
{

<div class="cellContainer" style="background-color: <?php echo $color;?>">
<div class="button1"><input type="checkbox" id="fld1[<?php echo $i;?>]" name="checkbox[]" value="<?php echo $row; ?>" onClick="document.getElementById('fld2[<?php echo $i;?>]').checked = document.getElementById('fld1[<?php echo $i;?>]').checked"/></div>
<div class="button1" style="visibility: hidden"><input type="checkbox" id="fld2[<?php echo $i;?>]" name="idprovider[]" value="<?php echo $row;?>"/></div>

$i++;
}

-enim

$i = 0;while($row = mysql_fetch_array($result)){

<div class="cellContainer" style="background-color: <?php echo $color;?>">
<div class="button1"><input type="checkbox" id="fld1[<?php echo $i;?>]" name="checkbox[]" value="<?php echo $row['destination']; ?>" onClick="document.getElementById('fld2[<?php echo $i;?>]').checked = document.getElementById('fld1[<?php echo $i;?>]').checked"/></div>
<div class="button1" style="visibility: hidden"><input type="checkbox" id="fld2[<?php echo $i;?>]" name="idprovider[]" value="<?php echo $row['id_provider'];?>"/></div>

$i++;
}
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.