Hello All,
This is my first web perl program.
I want the user to select an option from a drop down menu, then click
submit.
The program should then go to a new web page to display the results.
The below code displays all the info on the one page, how do I move to new
web pages.
I want to build the program up so that each new web page gathers more and
more info from
the user, then culminates in a final page that emulates the users
selections.
Any suggestions or pointers would be great.
shane.
#!perl.exe
require DBI;
use CGI;
use strict;
my $dbh = DBI->connect("DBI:mysql:database=golf;host=localhost");
my $current_time = localtime;
my $query = new CGI;
&select_tournament();
&show_result();
sub select_tournament {
print $query->header;
print "<HTML>\n<HEAD>\n<TITLE>GOLF Inc</TITLE>\n</HEAD>\n<BODY>\n";
print "<H1 COLOR=BLUE->Golfer Score Board</H1>\n";
print "<FORM>\n";
print "Current Tournaments\n";
my $sth = $dbh->prepare('SELECT cname, id FROM tournament');
$sth->execute();
my $row;
print "<SELECT NAME='tourn' SIZE=1>\n";
while ($row = $sth->fetchrow_arrayref()) {
print "<option value='$$row[0]'>$$row[0]</option>\n";
}
print "</select>";
print "<P>\n";
print "<INPUT TYPE='submit'>\n";
print "</P>\n";
print "</FORM>\n";
print "</BODY>\n</HTML>\n";
# Disconnect from the database.
$dbh->disconnect();
}
sub show_result {
my $query = new CGI;
print "<HTML>\n<HEAD>\n<TITLE>GOLF Inc 2</TITLE>\n</HEAD>\n<BODY>\n";
print "<FORM>\n";
print "<HR>\n";
print "<H1 COLOR=BLUE->Golf Tournament:</H1>\n";
print "<b>Selection:</b> " . $query->param('tourn') . "<br>\n";
print "</FORM>\n";
print "</BODY>\n</HTML>\n";
print "<HR>\n";
}
Thanks,
shane..
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]