kandrou
asked on
Creating html file with comments submitted by user through a form
I would like to write a perl script (don't know if possible) that will take the information from a form (submitted by the user on the web-site) and create an html file. Each time a user submits the form, the information is appended to the html page that has been created. Therefore, the users can interactively communicate with each other ..so to speak! I am able to write a perl script that sends me an email with the information in the form but I don't know how to append to an html file that I have already created. Any information/references or example code will be much appreciated!
ASKER
Does it append the information from the form to the end or middle of the html file? I ask this because if I have an HTML template and each time the form is submitted it adds the text to the end, what happens to the ending tags in the html file ie. </body></head>
The way I do it it will add to the end of the file. Alternatively, you can do this:
You have these files:
header.html
inbetween.html
footer.html
And do this with it:
open outfile, ">index.html";
open infile, "<header.html";
print outfile <infile>;
close infile;
open infile, "<inbetween.html";
print outfile <infile>;
close infile;
print outfile, "Data you want to add";
open infile, "footer.html";
print outfile <infile>;
close infile;
close outfile;
This would accomplish what I think you want
You have these files:
header.html
inbetween.html
footer.html
And do this with it:
open outfile, ">index.html";
open infile, "<header.html";
print outfile <infile>;
close infile;
open infile, "<inbetween.html";
print outfile <infile>;
close infile;
print outfile, "Data you want to add";
open infile, "footer.html";
print outfile <infile>;
close infile;
close outfile;
This would accomplish what I think you want
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!!
index.html
And the perl script need to append to that like this:
#
open outfile, ">>index.html";
print outfile "Newentry <br>\n";
close outfile;
#
That should append to the current html file and html code you'd give to it.
I think that's what you want.. ?