#!/perl/bin/perl use strict; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use DBI; my $q = new CGI; print header(); #print "Test"; my $userip = $ENV{'REMOTE_ADDR'}; #print $userip; my $curr_dir; #print $userip; # Grab the current directory from $0. BEGIN { $0 =~ '(.*[\\\/])\w+\.\w+$'; $curr_dir = $1 || "./"; } my $display = &filter($q->param('display')) || ''; my $insert = &filter($q->param('insert')) || ''; my $confir = &filter($q->param('confir')) || ''; my %AoH; if($insert eq "insert"){ $AoH{MESS} = "OK your message has been received!"; }else{ $AoH{MESS} =""; } print "<br><b>I must to print these values here once the buttons on th +e form has been clicked:</b><br>***INSERT=$insert******DISPLAY=$displ +ay******CONFIR=$confir######<br>"; my $out_file; $out_file = "${curr_dir}table.html"; open(OUTPUT, "$out_file") || print "L40 - There is no file here, I'll +run away now!"; while(<OUTPUT>) { $_=~s/<!-- (\bMESS\b)\/\/ -->/$AoH{MESS}/g; print $_; } close OUTPUT; ####################################### ### Filter - Gets rid of characters that screw up the program. sub filter { if($_[0]){ $_[0]=~s/\s+$//; $_[0]=~s/\'/\\\'/g; $_[0]=~s/<//g; $_[0]=~s/>//g; $_[0]=~s/;//g; $_[0]=~s/\(//g; $_[0]=~s/\)//g; $_[0]=~s/\"//g; $_[0]=~s/\'//g; $_[0]=~s/\?//g; $_[0]=~s/\<script//g; #$_[0]=~s/\///g; $_[0]=~s/>//g; #$_[0]=~s/\%2F//g; return $_[0]; }else{ return ''; } } ### End Filter Sub
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3 +.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Test</title> </head> <body> Test<br> <form name="upf" method="post"> <input type="hidden" name="update" value="update"> <input type="submit" name="upf" value="Cancel" onClick="docum +ent.upf.action='test.pl';"> <br><br> <input type="submit" name="upf" value="Insert" onClick="docum +ent.upf.action='test.pl?insert=insert';"> <br><br> <input type="submit" name="upf" value="Confirm" onClick="docu +ment.upf.action='test.pl?confir=confir';"> </form> <!-- MESS// --> </body> </html>
In reply to Passing Parameters Help! by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |