OK, Now I got a beautiful form with appropriate checkbox values. To those who have re-asserted my need to understand CGI.pm I agree and the Mouse is in the mail to me now, the Rat was less than helpful.
Problem is that I can't seem to figure why I end up with an empty array no matter whether boxes are checked or not. I am assuming the array is empty cause I always end up with an empty txt file after I submit the form. 0 bytes in size it is. Have I made yet another dopey neophyte error?
Thanks again, and again, and.....
jg
#!/usr/bin/perl -w use strict; use CGI; use CGI ':standard'; use CGI::Carp qw/fatalsToBrowser /; my $q = CGI->new(); my $url="http://www.xxxxx.com/xxx/xxx/"; my $path_to_text="/home/xxxxx/www/xxx/xxx/body.txt"; my $this_script_url="http://www.xxxxxx.com/cgi-bin/xxxxx.cgi"; my $post_number; my @updated_text; $/="\n\n\n"; #set the input Record seperator to a tri +ple newline if ( $q->param() ) { #if params are not undef # ignore deleted next if ( $q->param("box$post_number") ); # keep the rest s/&quot;/"/g; s/&apos;/'/g; push @updated_text, $_; # now update file open(FH,">$path_to_text") || die $!; print FH join "\n\n\n", @updated_text; close(FH); print "Location: $url\n\n"; } else { #if params are undef open (FH, "$path_to_text") or die "where's the damn file? : $!"; print "Content-type: text/html\n\n"; print qq|<HTML><BODY><center><form method="post" action="$this_scr +ipt_url">\n <TABLE width=600><TR bgcolor=#000066><TD colspan=2 align=c +enter> <font color=#ffffff><h2>Edit Your Posts</h2></font></TD><T +R><TD>|; while (<FH>) { next if /^\n+$/; #ignore lines which contains + only newlines $post_number++; chomp; s/"/&quot;/g; s/'/&apos;/g; print qq|Delete This Post? \n <input type=checkbox name="box$post_number" value=" $_ " c +hecked><p> $_<hr>\n<p>\n<br><br><br>\n|; } close FH; print "</TD></TR><TR bgcolor=#333333><TD align=center colspan=2> +\n"; print "<input type=submit name=Submit value=\"Delete Checked Pos +ts\"></TD>"; print "</form></center></table></body></html>"; } exit;
_____________________________________________________
If it gets a little bit out of hand sometimes, don't let it fool you into thinkin' you don't care.TvZ

In reply to Re: Loading $_ as checkbox value when $_ has double quotes in its value by jerrygarciuh
in thread Loading $_ as checkbox value when $_ has double quotes in its value by jerrygarciuh

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.