Re: Re: deleting records using a checkbox
| From: | Paul Burney | Date: | Thu, 20 Mar 2003 15:22:15 +0000 |
| Subject: | Re: Re: deleting records using a checkbox | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26515@lists.php.net to get a copy of this message | ||
on 3/20/03 1:45 AM, olinux at olnx@yahoo.com appended the following bits to
my mbox:
> [ and ] are illegal characters. #javascript
I'm coming into this a bit late, so I'm not sure exactly what you wish to
do.
You can use JavaScript to refer to checkbox items in the format:
document.forms[formindex].elements[elementindex].property
In my MySTRI database table administration program, I have an "x" button
that allows you to select all displayed rows to mark for deletion. The
button looks like:
<input
type="button"
title="Check/Uncheck All"
value=" X "
onclick="
for (var q = 0; q < document.forms[1].length; q++) {
document.forms[1].elements[q].checked =
!document.forms[1].elements[q].checked;
}
">
The checkbox fields look like:
<input type="checkbox" name="delete_rows[]" value="25679">
Not as easy as referring to the name element, but it works very well.
Another idea is to use "id" elements for JavaScript / DOM interaction and
reserve the "name" elements for php. That should work on any modern browser
(sorry, no Netscape 4.x).
HTH.
Sincerely,
Paul Burney
<http://paulburney.com/>
<?php
while ($self != "asleep") {
$sheep_count++;
}
?>