in reply to Re^2: Perl CGI redirect
in thread Perl CGI redirect
Thanks for the help... Changed it to add text box. However this is opening in the same page. Is is possible to open on a new page and also check for mutiple servers
#!/usr/bin/perl # n.cgi use strict; use CGI qw( :standard ); use CGI::Carp qw( fatalsToBrowser ); use POSIX qw(strftime); my $today = time; my $yesterday = $today - 60 * 168 * 60; my $FM = strftime "%m-%d-%Y", ( localtime($yesterday) ); my $TM = strftime '%m-%d-%Y', localtime; # page layout my $page =<< "EndOfText"; <h2>NBU Backup Report</h2> <form name="form" method="post" action="n.cgi"> <table> <tr> <td align="right"><strong>Hostname</strong></td> <TD> <TEXTAREA NAME="server" ROWS=1 COLS=30 WRAP="server"></TEXTAREA> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td> </td> <td> <input type="submit" name="action" value="Search" /> </td> </tr> </table> </form> EndOfText # get parameters my $q = CGI->new; my $action = $q->param('action'); my $server = $q->param('server'); # construct URL my $URL = "http://a.com:8080/bms/healthMonitor.do?method=redirect&oper +ation=BackupHistorySearch&subOperation=GetReport&clientName=$server&f +romDateStr=$FM&toDateStr=$TM"; # redirect if required if ($action eq 'Search'){ # remove hash to redirect print $q->redirect($URL); } else { print $q->header, $q->start_html('Page Title'), $page, # hash out next 2 lines or remove if OK # $q->p("Vars action=$action : server=$server : FM=$FM : TM=$TM "), $q->a({-href=>$URL, -target=>'_blank'},$URL), }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl CGI redirect
by poj (Abbot) on Apr 17, 2013 at 15:53 UTC | |
by Anonymous Monk on Apr 17, 2013 at 19:59 UTC | |
by poj (Abbot) on Apr 17, 2013 at 20:31 UTC |