I am really struggling to get something working and each time I think I get there I have to go back to the drawing board and start again, so in that if its OK I haven't got anything to show as I need new ideas or if possible the script itself if its already been done.
What I have is a form in a CMS where as well as all the other data the client has the option of uploading up to 4 images, they can upload 1, 2 3 or 4.
I actually have had this working, where the image goes to the server and the path to the database, but where I go wrong is when he comes to edit that piece of stock. Again as well as being able to edit anything on that item, I want to be able to update an image or add an extra one in, or if OK none of the images.
So basically on the edit bit, they can edit 1,2,3 or all 4 of the images, and if less than all 4 it doesn't impact on the other remaining images, they stay as they are, only the one they edited is upadted.
Can this be done, as I have been weeks on this, been to many forums and cant find any help at all.
Please, please help me.
OK this is the script Im using to do the first upload.
- Code: Select all
//echo $_FILES['pic1']['tmp_name'][$i]." :". $path1;
$q=mysql_query("insert into stock (stock_Name, stock_MetaTitle, parent_Category, sub_Category, stock_Ref, stock_Description, stock_Maker, stock_Date, stock_Weight, stock_Height, stock_Depth, stock_Width, stock_Price, stock_Sold, stock_Image, stock_Image2, stock_Image3, stock_Image4, stock_Active, stock_DateTime) values('$name','$meta','$pcats','$subcats','$ref','$desc','$maker','$date','$weight','$height','$depth','$width','$price','$sold','imgdata/stock/$pic1','imgdata/stock/$pic1','imgdata/stock/$pic1','imgdata/stock/$pic1','$active','$dt2')") or die (mysql_error());
$conf="Data Inserted Successfully - Click <a href='http://www.accendsandbox.co.uk/adminSallam/admin_stock.php'>here</a> to continue";
And here is the images part of the form. There are 4 image upload options.
- Code: Select all
<form name="form1" action="admin_stock.php?index=<?=$index?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="flag" value="<?= $flag?>">
<input type="file" name="pic1" id="pic1" size="50" />
<input type="submit" name="btnsubmit" value="Submit">
<input type="submit" name="btndelete" value="Delete" onClick="return check();">
<input type="hidden" name="srno1" value="<?= $rows["stock_Id"];?>">
<input type="hidden" name="action" value="Upload">
What I need help with is when the client clicks a stock item to edit it, the 4 image upload section is there and the client to update none of them or any of the 4, and if he doesnt change any then they stay as they are, or if he updates 1,2 or 3 then the remaining ones arent changed or deleted either, they stay as they are in the database.