[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

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!
0
kandrou
Asked:
kandrou
  • 3
  • 2
1 Solution
 
binkzzCommented:
Say your original file was called:

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.. ?
0
 
kandrouAuthor Commented:
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>
0
 
binkzzCommented:
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
0
 
binkzzCommented:
Make that last

open infile, "footer.html";
  print outfile <infile>;
close infile;

to:

open infile, "<footer.html";
  print outfile <infile>";
close infile;

Thank you :)
0
 
kandrouAuthor Commented:
Thanks!!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now