don't your checkboxes act like radio buttons when you check them if they all
have the same name?

i would do something like

<form name="mail_boxes" action="" method="">
<?php

// How ever many checkboxes you want
$number_of_checkboxes = 5;
for ( $this_check = 0; $this_check < $number_of_checkboxes; $this_check++ )
{
        echo "<input type=\"checkbox\" name=\"broker:" . $this_check . "\"
value=\"$this_check\">\n";
}

?>

<script language="JavaScript">
<!--

function check_all( num_boxes ) {
        for ( this_box = 0; this_box <= num_boxes; this_box++ ) 
                document.mail_boxes['broker:' + this_box].checked = true;
}

// -->
</script>


<input type="button" name="checkall" value="Select All"
onClick="javscript:check_all(<?php $numberof_checkboxes ?>);">


That's all completely untested, but it might work :P

// -----Original Message-----
// From: olinux [mailto:[EMAIL PROTECTED]]
// Sent: Tuesday, 10 July 2001 7:43 AM
// To: php-db
// Subject: [PHP-DB] parsing checkbox array without [] and selecting all
// boxes
// 
// 
// Hey all,
// 
// The end result of all of this should be similar to an online 
// email client
// like hotmal, or yahoo where  you can select a number of 
// messages to be
// deleted.
// 
// I have a form that when generated, the html looks similar to this:
// 
// ===================================
// 
// <input type="checkbox" name="broker" value="1">
// <input type="checkbox" name="broker" value="2">
// <input type="checkbox" name="broker" value="3">
// <input type="checkbox" name="broker" value="4">
// <input type="checkbox" name="broker" value="5">
// 
// <input type=button value="Check All"
// onClick="this.value=check(this.form.broker)">
// 
// ===================================
// 
// I am trying to create a script that will delete each checked 
// box. I can get
// this script to work by adding '[]' to 'broker'  The reason 
// for each name
// being the same and not using the '[]' is because I want to 
// be able to use a
// javascript that selects all boxes. Is there a way to do 
// this. Or better yet,
// does anyone have a jscript that will work with the [] characters?
// 
// Thanks
// olinux
// 
// 
// _________________________________________________________
// Do You Yahoo!?
// Get your free @yahoo.com address at http://mail.yahoo.com
// 
// 
// -- 
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, e-mail: [EMAIL PROTECTED]
// For additional commands, e-mail: [EMAIL PROTECTED]
// To contact the list administrators, e-mail: 
// [EMAIL PROTECTED]
// 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to