Hello,
Any help would be really appreciated ....... <sigh>
I have been racking my head for 2 days tiring to get four pictures to unlink. The best way I have found is to use a checkboxes but I only wont to check one box that would array the other three. I have tried java but I would receive a error
###############
Warning: unlink() failed (Permission denied) in c:\phpdev5\www\public\mincom\item_delete_save.php on line 45
Below is both pages..... first one is the form and the one below it is the return of the submission
################
echo "
<tr bgcolor=#FFFFFF>
<td height=20 align=center >
<input name=chk_1[] type=checkbox value=$row[autoid]>
<input name=to_delete[] type=checkbox value=$row[item_main_picture]>
<input name=to_delete[] type=checkbox value=$row[item_main2_picture]>
</td>
<td height=20 align=left nowrap>
<a href='item_modify.php?itemcode=".urlencode($row[itemcode])."'><font color=#000000>$row[itemcode]</font></a>
</td>
<td height=20 align=left Nowrap>
$row[categorytype]
</td>
<td height=20 align=left Nowrap>
<FONT color=red>$row[status]</FONT>
</td>
<td height=20 align=left Nowrap>
$row[itemname] <FONT color=red>$row[feature]</FONT>
</td>
<td height=20 align=left Nowrap>
$row[submittime]
</td>
<td height=20 align=left Nowrap>
$$row[saleprice]
</td>
</tr>
";
}
echo "
<tr bgcolor=#FFFFFF>
<td align=left colspan=7 >
<input type=submit name=smt_delete value=Delete>
</td>
</tr>
</table>
</td></tr><B>NOTE:</B> <i>To Modify Item, Click On Stock Number</i><BR></table>
</form>
";
######################## Submit
<?php
$dbquery = "select * from itemmaster where autoid=\"$chk_1[0]\"";
$result = mysql_db_query($dbname,$dbquery); if(mysql_error()!=""){echo mysql_error();}
if($row = mysql_fetch_array($result))
{
$numrows = count($chk_1);
for($i=0;$i < $numrows;$i++)
{
$dbquery = "select categorytype from itemmaster where autoid=\"$chk_1[$i]\"";
$result = mysql_db_query($dbname,$dbquery); if(mysql_error()!=""){echo mysql_error();}
if($row = mysql_fetch_array($result))
{
$categorytype=$row[categorytype];
$dbquerycategory = "Update categorymaster set ";
$dbquerycategory = $dbquerycategory." items_in_category=items_in_category-1 ";
$dbquerycategory = $dbquerycategory." where (categorytype=\"$categorytype\")";
$resultcategory = mysql_db_query($dbname,$dbquerycategory);
if(mysql_error()!=""){echo mysql_error();}
}
///////////////////////////////
foreach($_POST['to_delete'] as $item_main_picture) {
if (file_exists("images/mainpicture/".$item_main_picture) ) {
unlink("images/mainpicture/".$item_main_picture);
}
}
foreach($_POST['to_delete'] as $item_main2_picture) {
if (file_exists("images/mainpicture/".$item_main2_picture) ) {
unlink("images/mainpicture/".$item_main2_picture);
}
}
//////////////////////////////////////////
$dbquery = "delete from itemmaster where autoid=\"$chk_1[$i]\" ";
$result = mysql_db_query($dbname,$dbquery); if(mysql_error()!=""){echo mysql_error();}
}
echo "
<TABLE cellspacing=0 cellpadding=0 Align=center width='500' border=0>
<tr><td align=center height=25><font class=\"adminstd\"><b>STATUS</b></font></td></tr>
<tr><td align=center height=25><font class=\"adminstd\"><b>Requested Information has been Deleted.</b></font></td></tr>
</table>
";
}
else
{
ErrMessage("Access Denied");
}
?>