Dear Beginner-cgi:
    I used a CGI program to load a HTML form page as shown below, 
After I filled the form and submit, the results is just attached to the initiated form 
page when it leads to the new webpage. My question is: how can I load to a new HTML 
page after I submit the form? 
 
********************************************************************************
#!C:\Perl\bin\perl.exe
use lib "C:\Perl\lib";

use FileIO;
use SeqFileIO;
use CGI qw/:standard/;

use Bio::Perl;
use Bio::Tools::Run::RemoteBlast;
use strict;
use warnings;

print header,
    start_html(' Form'),
    '<body bgcolor=#AFD2DF>',
    h1('<font color=black> BLAST Network Service!</font>'),p,
    "This is a NCBI BLAST2 service",
    hr,
    start_multipart_form,
    '<font color=black>',
    h3("1) Sequence file name (FASTA or RAW format):  "),
    filefield(-name=>'fileseq',
        -default=>'starting value',
        -size=>50,
        -maxlength=>200,
    ), p,
    strong(em("or")),
    h3("Type sequence:  "),
    textarea(
        -name=>'typedseq',
        -rows=>10,
        -columns=>40,
        -maxlength=>1000,
    ), 
 'Output format:<select name="action">
 <OPTION value="Normal" selected="selected">HTML
 <OPTION value="NiceBlast">NiceBlast
 <OPTION value="PlainText">Plain Text
 </select>',
p,
    h3("2) Submit the BLAST searching:"),
    '<input type=submit value="Run BLAST"> or <input type=reset value="Reset Form">', 
p,
    '</font>',
    hr,
    end_form;
    end_html;
print end_html;

if (param()) {
    my $sequence = '';
    # must have exactly one of the two sequence input methods specified
    if(param('typedseq') and param('fileseq')) {
        print "<font color=red>You have given a file AND typed in sequence: do only 
one!</font>", hr;
        exit;
    }elsif(not param('typedseq') and not param('fileseq')) {
        print "<font color=red>You must give a sequence file OR type in 
sequence!</font>", hr;
        exit;
    }elsif(param('typedseq')) {
        $sequence = param('typedseq');
    }elsif(param('fileseq')) {
        my $fh = upload('fileseq');
        while (<$fh>) {
     /^\s*>/ and next; # handles fasta file headers
     $sequence .= $_;
        }
    }
    # strip out non-sequence characters
    $sequence =~ s/\s//g;
    $sequence = uc $sequence;
    hr;
print "need to go to a new page!!!!";
}
********************************************************************************
Thanks in advance.
Jane
 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to