
srehal
Deleted
Mar 31, 2000, 7:17 AM
Post #1 of 2
(455 views)
|
|
Deleting an item from a list
|
Can't Post
|
|
I have a list of documents on a page and I want the user to input the number associated with a particular document in a text field and then press the delete button.This should call a cgi script which should display to the user a new list minus the deleted document. I have this code so far: $NumberToDelete=$FORM{"numbertext"}; #opens a file to read #checks to see if the number entered is the same as a number in the .csv file #if it is then we want to delete it #open(READONLY,"<document.csv"); # if ($NumberToDelete==Number) { # print ("$Number,$Description,$Author,$Date,$Document\n"); # } # print("You have entered a number that does not belong to an existing #document"); open(READONLY,"<document.csv"); if ($NumberToDelete==Number) { open(NEWFILE, ">>../NewDocument.csv"); print "$Number,$Description,$Author,$Date,$Document\n"; } print("You have entered a number that does not belong to an existing document"); close(NEWFILE); close (READONLY);
|