in reply to Loading $_ as checkbox value when $_ has double quotes in its value
_____________________________________________________#!/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/"/"/g; s/'/'/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/"/"/g; s/'/'/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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Loading $_ as checkbox value when $_ has double quotes in its value
by virtualsue (Vicar) on Dec 05, 2001 at 21:53 UTC | |
|
Re: Re: Loading $_ as checkbox value when $_ has double quotes in its value
by atcroft (Abbot) on Dec 06, 2001 at 07:48 UTC |