CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Guestbook

 



benchivers
Deleted

Jan 7, 2001, 1:01 PM

Post #1 of 5 (1402 views)
Guestbook Can't Post

I am trying to create a guestbook. How do I make it so that it prints the information from the form handler to a html file between two tags and making it appendable between the two tags.



sleuth
Enthusiast

Jan 10, 2001, 12:42 AM

Post #2 of 5 (1392 views)
Re: Guestbook [In reply to] Can't Post

 
This takes a bit to explain and I'm not sure if you're checking your post for answers anymore but if you are reply and I'll explain it for you. And you might as well tell me what tags you want to use.

Sleuth



benchivers
Deleted

Jan 10, 2001, 10:31 AM

Post #3 of 5 (1387 views)
Re: Guestbook [In reply to] Can't Post

I would be grateful if you would tell me. I don't mind what tags we use, just whatever makes it easier for you. CHEERS!



sleuth
Enthusiast

Jan 10, 2001, 2:22 PM

Post #4 of 5 (1383 views)
Re: Guestbook [In reply to] Can't Post

 Ok just checking there.

First you must open the file, then separate the top and bottom from each other with those tags. So if your using tags like these:

top html
<!-- Start -->
Content
<!-- End -->
bottom html

Then use this code.

open(data, "<file.html");
while(<data>)
{
$file .= "$_";
}
close(data);
($top,$crap)=split(/<!-- Start -->/, $file);
($content,$bottom)=split(/<!-- End -->/, $crap);

Now you have to top html in $top and the bottom in $bottom, so now you have to take the input passed to you script and append it to the content between the tags, like so,

$content .= qq~
A table with the input passed to your script.
~;

Now you can overwrite the html file with the new content.

You'll have to put the tags back in because when we used them to split up the file they were taken out.

$tag = "<!-- Start -->";
$tag2 = "<!-- End -->";

open(data2, ">file.html");
print data2 "$top$tag$content$tag2$bottom";
close(data2);

That's it.

Sleuth



benchivers
Deleted

Jan 11, 2001, 10:38 AM

Post #5 of 5 (1377 views)
Re: Guestbook [In reply to] Can't Post

Thanks Sleuth I really apreciate it!


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives