Gossamer Forum
Home : General : Perl Programming :

How to delete an entry

Quote Reply
How to delete an entry
How would I write a code in a CGI script to allow an admin to delete and entry? I know how to add it already.
Code:
#!/usr/local/bin/perl

#full path to the guestbook file where users will go
$guestb_loc = "http://nytesoft.hypermart.net/cgi-bin/test/guestbook.html";

#translate to <br> for a better look


#open guestbook file and append to the end of it
open(GUEST, ">>$guestb_loc");

#print information
print GUEST "\n<UL>\n";
print GUEST "{'comments'}";
print GUEST "\n<b>{'name'}<br>\n";
print GUEST "{'location'}</b><br>\n";

close (GUEST);

------------------
Patrick Chukwura
Nytesoft WebSolutions
nytesoft.hypermart.net
Quote Reply
Re: How to delete an entry In reply to
Ok. the way you have things working is that it justs prints out to an html file. it would be a whole lot easier to delete the files if you made it write to a database file, and had the guestbook script call on the db file. I dont know how to deltet it the way you have things set up.

------------------
Quote Reply
Re: How to delete an entry In reply to
Do you write to a database file(.db) the same way you write to a .html file?

------------------
Patrick Chukwura
Nytesoft WebSolutions
nytesoft.hypermart.net
Quote Reply
Re: How to delete an entry In reply to
The same way as you write to anywhere else Smile

Code:
open(FILE, ">$target");
print FILE "any data to print";
close (FILE);

This way you can write to any file: HTML, TXT, CFG, etc....

Regards,

Pasha

------------------
webmaster@find.virtualave.net
http://find.virtualave.net