Ask a Question related to PHP Development, Design and Development.
-
Jorge Ferreira #1
Delete Multiple items with checkboxes
Hello all,
I'm sorry for posting this because you probably answered this question a
million times, but i didn't got my script to run yet.
I'm using:
- PHP 4.3.4
- Mysql
- Apache 2
So the problem is that when i try to know witch checkboxes were hit, php
only returns the last one: imagine that you checked the 10,11,12 and 13;
it only sees the 13.
The code is something like this:
<?
$sql = "Select id from table";
$rst = mysql_query($sql);
while ($row = mysql_fetch_array($rst))
{
?>
<input type="checkbox" name="check" id="<? echo($row["id"])?>">
<?
}
?>
and then, when you want to know witch ones were hited,
<? echo $check ?>
And it was supposed to write (10,11,12,13) right?
The problem is he only echoes the 13.
Can you help, please?
Jorge Ferreira
##-----------------------------------------------#
Article posted from PHP Freaks NewsGroup
[url]http://www.phpfreaks.com/newsgroup[/url]
Get Addicted: alt.comp.lang.ph
##-----------------------------------------------##
Jorge Ferreira Guest
-
How to delete items NOT in a list
I have a table with current movie titles identified by ID number and another table with reviews of those items, also containing the ID number. The... -
Checkboxes in grid/delete row not working
I copied the code for this direclty from http://www.asfusion.com/blog, but for some reason when I go to delete a row in the grid, it merely leaves... -
delete mulitple records with checkboxes
i have a recordset with a looped region and checkboxes each checkbox has the individual record id assigned to it my questions is what SQL command... -
can not delete items from desktop (2k server & AD)
Hello, I deleted some items from desktop. When I log on, items came back. We have 2k server with AD. Profie are on server. Thanks for your... -
multiple delete with checkboxes ?
Hi ! back again... got this problem with multiple delete with checkboxes. when i click the 'Delete user' link i get all users in the db listed... -
Alvaro G Vicario #2
Re: Delete Multiple items with checkboxes
*** Jorge Ferreira wrote/escribió (Tue, 01 Jun 2004 05:31:42 -0500):
Two options:> So the problem is that when i try to know witch checkboxes were hit, php
> only returns the last one
1) Give each field a different name:
check1, check2, check3...
2) Append "[]" to name to force several fields to be treated as an array
name="check[]"
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Alvaro G Vicario Guest
-
Mart #3
Re: Delete Multiple items with checkboxes
Jorge Ferreira wrote:
use it like this then php gets an array back after posting> Hello all,
>
> I'm sorry for posting this because you probably answered this question a
> million times, but i didn't got my script to run yet.
>
> I'm using:
>
> - PHP 4.3.4
> - Mysql
> - Apache 2
>
> So the problem is that when i try to know witch checkboxes were hit, php
> only returns the last one: imagine that you checked the 10,11,12 and 13;
> it only sees the 13.
> The code is something like this:
> <?
> $sql = "Select id from table";
> $rst = mysql_query($sql);
> while ($row = mysql_fetch_array($rst))
> {
> ?>
> <input type="checkbox" name="check" id="<? echo($row["id"])?>">
> <?
> }
> ?>
>
> and then, when you want to know witch ones were hited,
>
> <? echo $check ?>
> And it was supposed to write (10,11,12,13) right?
> The problem is he only echoes the 13.
>
> Can you help, please?
>
> Jorge Ferreira
>
>
>
> ##-----------------------------------------------##
> Article posted from PHP Freaks NewsGroups
> [url]http://www.phpfreaks.com/newsgroups[/url]
> Get Addicted: alt.comp.lang.php
> ##-----------------------------------------------##
<input type="checkbox" name="check[]" value="<? echo($row["id"])?>">
Mart
Mart Guest



Reply With Quote

