This is a discussion on "Delete Image with PHP Script" within the PHP Forum section. This forum, and the thread "Delete Image with PHP Script are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Delete Image with PHP Script
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
I have a picture uploading form that loads up a picture with information about that picture.
I have a text file that contains a tabulated line containg specific information about each picture, this information is generated by a PHP script. I have another PHP script that reads the text file, splits the line into different variables, and prints the information in a table. The last cell of each row has a red "X" to be used for deleting the image; this red "X" is what I am trying to make work. I am trying to develop a PHP script that will read the text file, and mark the image to be deleted. My problem is that I don't know how to make the PHP script look for the right image once the delete button on the row is clicked. The PHP script is what generates the table, so the table tags are only printed once in the PHP script; I have a while loop that prints the information, and since the information is appended to the text file, the table grows a row each time a new picture is uploaded. How will my PHP delete script know which image to delete once the user clicks the "X" at the end of the row? Can someone shed some light on this subject? |
|
|
|
#2
|
||||
|
||||
|
Re: Delete Image with PHP Script
This makes my head spin a little, LOL. Maybe it's because my immediate instinct to the basic process would not include making a text file. There's something I'm not following about the program structure.
Do you want a user to be able to "mark" a photo for deletion but keep control of the actual deletion? That's what I'm reading. Here's one idea anyway. Have a boolean field default to 0. To display the form contents for the "mark for delete" function, query the database. Let the user, possibly, hit a radio button to change the boolean field to 1. Then you can have a separate administrative form, with delete permission, that shows all rows with delete=1. |
|
#3
|
|||
|
|||
|
This is absolutely driving me crazy. My text file lists all the data as it pulls from the uploading form I made. All the variables that I have listed in the uploading form are what I used to generate the text file, by writing into it like this:
fputs(V\t$forpic\t$date\t$time...etc.) This writes the information into the text file. If the file is not an image file, the V at the front of the line becomes an X instead. The other php script that writes all of the info into the table only prints a new row of the table if the V is in the beginning of the line in the text file. My instructor wants me to read the whole file and replace the first character of the line with the picture I want to delete with an X. But how do I know which image I will be deleting when the delete button is a picture of a red x on my table page? How can I find out which image is in the row of the table where the red x has been clicked? There is a red x at the end of each row. Does this make sense? |
|
#4
|
|||
|
|||
|
Re: Delete Image with PHP Script
Quote:
|
![]() |
| Tags |
| delete, php, tables |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Gah, need a javascript image resizing script. | JasonStanley | JavaScript Forum | 3 | Nov 6th, 2007 18:51 |
| [SOLVED] Image script problem | philsando | JavaScript Forum | 5 | Oct 4th, 2007 13:58 |
| Image Gallery Script Help | r00tk1ll | JavaScript Forum | 4 | Aug 26th, 2007 23:22 |
| Help with PHP script that would read & delete a row from | classifieds100 | PHP Forum | 3 | May 30th, 2005 09:38 |
| Image Upload/Delete | ekendricks | Classic ASP | 5 | Nov 18th, 2003 12:36 |