Alright, I told myself that I would figure it out by myself, but I can't do it, so this is my cry for help, yet again, to the Perl brotherhood:
#! /usr/local/bin/perl -w use strict; use CGI qw(:standard); my $q=CGI->new(); open(FH,"+>>message.txt") || die("Cannot Open Data File.. Error"); seek(FH, 0,0); my $data = <FH>; print "Content-type:text/html\n\n"; print $q->start_html("My Message Board"); print "<h2>My Message Board</h2><br><hr>"; print $data; print "<p><hr><br>Post:<br>"; print "<center><form action=\"hw5.pl\" method=\"POST\">"; print $q->textarea(-rows=>6, -columns=>75, -name=>'text'); print "<br>"; print $q->submit(-value=>'Submit When Completed', -name=>'submit'); print "</form></center>"; print $q->end_html(); my $value=$q->param('text'); $value =~ s/\+/ /; $value =~ s/\r//g; $value =~ s/\n/ /g; print FH "$value"; close(FH);
I'm getting errors where I try to print the $data, and again where I try to change my incoming $value to be appended. Any point in the right direction, or words of wisdom would be appreciated.

Thanks,

alarthame

Update! I fixed that code a bit to reflect where I am right now. Thanks to Enlil for that little note that dealt it with the +>> I think that did it.

I'm still trying to get it so it won't tag on blank lines when I refresh the page. I've tried putting a line that stops the post if it's null, down by the $value, but that doesn't seem to work. Also, I'm not quite sure how to reset the textfield on a refresh. It like to repost the last entry or a blank field.


In reply to Another Simple Message Board by alarthame

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.