<form method="POST" action="prosesMultiple.php">
	<?php
	include 'connection.php';
	$sql="SELECT  defect_code,totalDaily FROM grandTotal ORDER BY totalDaily DESC LIMIT 10 ";
	$row = mysql_query ($sql);
   	while ($check=mysql_fetch_array($row)){?>
	
	   <input type="checkbox" name="defect_code[]" id="defect_code[]" value="<?php echo $check["defect_code"];?>" />
	   <?php echo $check["defect_code"];?> - <?php echo $check["totalDaily"]; ?> 
	   <input name="text"  name="totalDaily[]" id="totalDaily[]" type="hidden"  value="<?php echo $check["totalDaily"]; ?>"><br/>
   <?php } ?>
<p><input type="submit" value="Send" name="Send"></p>
</form>

the problem is i want pass the value of defect_code and totalDaily together at same time? after user select the checkboxes..is it practical i do like that

Recommended Answers

All 4 Replies

Line 10, your input field has two name attributes, remove name="text" . Bye.

On line 10, it should be input type="text".

and you can also echo at the same time.

echo $check["defect_code"] . " " . $check["totalDaily"]

On line 10, it should be input type="text".

and you can also echo at the same time.

echo $check["defect_code"] . " " . $check["totalDaily"]

ok..im done do it..but i want user select only 5 value..this my coding

<script type="text/javascript">
function chkcontrol(j) {
var total=0;
for(var i=0; i < document.form1.defect_code[].length; i++){
if(document.form1.defect_code[i].checked){
total =total +1;}
if(total > 5){
alert("Please Select only five") 
document.form1.defect_code[j].checked = false ;
return false;
}
}
} </script>
</head>
<body>

<?php print(Date("d-m-Y"));?>	
<form method="POST" action="prosesMultiple.php"  name="form1">
	<?php
	include 'connection.php';
	$sql="SELECT  defect_code,dpuDaily FROM grandTotal ORDER BY dpuDaily DESC LIMIT 10 ";
	$row = mysql_query ($sql);
   	while ($check=mysql_fetch_array($row)){?>
	
	   <input type="checkbox" name="defect_code[]" id="defect_code[]" value="<?php echo $check["defect_code"];?>" onclick="chkcontrol()"; />
	   <?php echo $check["defect_code"];?> - <?php echo $check["dpuDaily"]; ?> 
	   <input   name="dpuDaily[]" id="dpuDaily[]" type="hidden"  value="<?php echo $check["dpuDaily"]; ?>"/><input name="Date[]" type="hidden" id="Date[]" value="<?php echo Date("Y-m-d"); ?>" /><br/>
   <?php } ?>
<p><input type="submit" value="Send" name="Send"></p>
</form>

the script not runing..

There's a syntax error.. you cannot place a double quote (") inside an n existing quote. For Example in Line number 27.

<input   name="dpuDaily[]" id="dpuDaily[]" type="hidden"  value="<?php echo $check["dpuDaily"]; ?>"/><input name="Date[]" type="hidden" id="Date[]" value="<?php echo Date("Y-m-d"); ?>" /><br/>

<!-- This should be like this -->

<input   name="dpuDaily[]" id="dpuDaily[]" type="hidden"  value="<?php echo $check['dpuDaily']; ?>"/><input name="Date[]" type="hidden" id="Date[]" value="<?php echo Date('Y-m-d'); ?>" /><br/>

Please Correct all this type of Errors First.

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.