ccrevcypsys Posted October 31, 2007 Share Posted October 31, 2007 how would i make it to where someone can press all and it selects all of the check boxes in the area Quote Link to comment Share on other sites More sharing options...
Orio Posted October 31, 2007 Share Posted October 31, 2007 That's JavaScript, no PHP. Orio. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted October 31, 2007 Share Posted October 31, 2007 You need to use JavaScript http://www.hscripts.com/scripts/JavaScript/select-all-checkbox.php Quote Link to comment Share on other sites More sharing options...
ccrevcypsys Posted October 31, 2007 Author Share Posted October 31, 2007 well i need to get it to work with php and i dont know how... here is my php code (and im using a different java method) <?php while ($row_region = @mysql_fetch_array($result_region, MYSQL_ASSOC)){ $sel = ""; if ($row[asia_pacific] == $row_region[keyid] || $row[EMEA] == $row_region[keyid] || $row[greater_china] == $row_region[keyid] || $row[latin_america] == $row_region[keyid] || $row[north_america] == $row_region[keyid] || $row[region] == $row_region[keyid]) { $sel = " checked"; }elseif(isset($_POST[''.$row_region[keyid].''])){ $sel = " checked"; } $region_opt .= "<input name='list' type='checkbox' value='$row_region[keyid]'$sel />$row_region[region_name]"; } $field_list = " <div style='margin-left: 100px'><input style='display:none;' type='text' name='region' rows='1' cols='35' value='0' /><em>All not yet working...</em><br><SCRIPT LANGUAGE='JavaScript'> <!-- Begin var checkflag = 'false'; function check(field) { if (checkflag == 'false') { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = 'true'; return 'Uncheck All'; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = 'false'; return 'Check All'; } } // End --> </script><input type=button value='Check All' onClick='this.value=check(this.form.list)'>".$region_opt."</div> "; $content .="<br /><div>".$prev_list."<form action='".$_SERVER['PHP_SELF']."?do=".$do."' name='frm1' enctype='multipart/form-data' method='".$method."'>".$field_list."<br /><div><input type='hidden' name='filename' value='".$row[file]."' /><input type='hidden' name='key' value='".$id."' /><input type='hidden' name='do' value='".$do."' /><input type='submit' value='".$action_text."' class='button' /></div></div>"; ?> Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 what is your select query what is keyid in the database Quote Link to comment Share on other sites More sharing options...
ccrevcypsys Posted October 31, 2007 Author Share Posted October 31, 2007 1 2 3 4 5 6 it goes by numbers but here it is ne way "result_region" => "SELECT * FROM regions ORDER BY region_name", Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 all i can say there is a problem with if ($row[asia_pacific] == $row_region[keyid] || $row[EMEA] == $row_region[keyid] || $row[greater_china] == $row_region[keyid] || $row[latin_america] == $row_region[keyid] || $row[north_america] == $row_region[keyid] || $row[region] == $row_region[keyid]) { how is $row being populated, from where does it come Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.