Re: Checkbox & Hidden Field to Delete Row - SOLVED

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

 



On Thursday 01 June 2006 13:15, Rahul S. Johari wrote:
> Ave,
>
> I spent 3 hours trying to find or develop a solution for this problem...
> And believe it or not, within 3 minutes of sending the problem to the
> mailing list, I actually generated a solution!! Ray, you’re spot on with
> what’s actually happening, but this is what I did to resolve it...
>
> Here’s my code to generate the Dynamic Row with Checkboxes:
> <td width=15><span class=\"style11\"> <input type=checkbox name=thisID[]
> value=\"$myrow[ID]#imsafm/$showfilesuser/$myrow[filename]\"><input
> type=hidden name=login value=$login><INPUT TYPE=hidden name=showfilesuser
> value=$showfilesuser></td>
>
> I completely eliminated the Hidden field... Instead, added the value of
> both the Row ID & the Filename to the checkbox, with a seperator “#”.
>
> Here’s my code to delete the Row & Corresponding File:
>
>         foreach($thisID AS $value) {
>         $pieces = explode("#", $value);
>         $sql = "DELETE FROM file WHERE ID='$pieces[0]'";
>         $result = mysql_query($sql) or die("Fatal Error: ".mysql_error());
>         $thefile = "$pieces[1]";
>         unlink($thefile);
>         }
>
> As you can see, I basically explode the Array on the “#” seperator, and
> delete the Row & File. Is working like a charm!!
>

Tad different, but that will definitely work as well.  It's a long shot, but 
just make sure that filenames don't have a "#" in them.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

-- 
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