Re: deleting multiple items from a database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Thus wrote Adil:
> 
> As far as the code goes what I'm doing is retrieving each record from the
> database and assigning the "value" attribute of each checkbox the unique id
> from the database.  From that point on, when a checkbox is checked and the
> delete button is pressed, I push each checked unique id into an array and
> then call a function that cycles through the array and deletes each database
> entry.  The last step is a simple page refresh.   I'm posting some of the
> more relevant sections of the code I've used below:
> 
> echo "<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
> //form declaration
> echo "<input type=\"submit\" value=\"Delete\"value=\"Submit\">";
> //The delete button
>     <td><input type=\"checkbox\"
> value=\"{$row['upload_id']}\"></input><br/></td>";        //This is what the
> checkbox is coded as

This is your problem, you need to give the checkbox a name:
<input type="checkbox" name="stack[]" value="...">

When the form is submitted $_POST['stack'] will contain an array of
items that were checked.


Curt
-- 
Quoth the Raven, "Nevermore."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux