#!h:/xampp/perl/bin/perl -w # PERL MODULES WE WILL BE USING use DBI; use DBD::mysql; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use dbConnect; require "ap_messages_config.pl"; #PULL IN THE FILE THAT CREATES EACH HTML RESPONSE PAGE #INCLUDES THE SUB 'STYLE' FOR CSS $q = new CGI; print $q->header(); my @values = split(/=/,$ENV{QUERY_STRING}); my $customer_get = $values[1]; my $customer_post = $q->param('customer_post'); my $num_buildings = ""; my $errors = ""; my @parameters = $q->param(); #THIS JUST STORES THE NAMES OF THE PARAMETERS. TO PRINT ITS VALUE, USE #param($parameters[0]) . "
\n"; ################################################################################################################# ############################## BEGIN MAIN PROGRAM ############################################################### ################################################################################################################# #style (); print $q->start_html(); if (($q->param('section_number')) < 2) { sectionOne($customer_get); } if (($q->param('section_number')) eq "2") { sectionTwo(); } if (($q->param('section_number')) eq "3") { sectionThree($customer_post); } if (($q->param('section_number')) eq "4") { sectionFour(); } print $q->end_html(); ################################################################################################################# ############################## BEGIN MAIN PROGRAM ############################################################### ################################################################################################################# ############################################## SUBROUTINES ###################################################### =pod sub javaScript() { # USE CGI 'start_html' TO ADD JAVASCRIPT TO HEADER print $q->start_html( -title=>'Enter AP Names', -script=> { -language => 'javascript', -src => '../scripts/hideDiv.js' } ); style (); } =cut ################################## HTML PAGE TO ASK USER NUMBER OF BUILDINGS ##################################### sub sectionOne() { print "Section One.
\n"; print "The value of \$customer_get is: $customer_get.
\n"; print "The value of \$customer_post is: $customer_post.
\n"; print "Enter the Number of Buildings:\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
"; } #print param('num_buildings') . "
\n"; #THIS WORKS #print param($parameters[0]) . "
\n"; #THIS WORKS TOO. ################################### HTML PAGE TO RENDER INPUT BOXES FOR BUILDING NAMES ############################ sub sectionTwo() { print "Section Two.
\n"; print "The value of \$customer_get is: $customer_get.
\n"; print "The value of \$customer_post is: $customer_post.
\n"; #print "The length of \@parameters is: $#parameters.\n"; print "\n"; print "\n"; my $num_buildings = $q->param('num_buildings'); for ($i=1; $i<=$num_buildings; $i++) { print "\n"; print "\n\n"; print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Building: " . $i . "
"; print "\n"; print "
\n"; } ###################################### PRINT AND CONFIRM BUILDING NAMES ########################################3 sub sectionThree() { print "$_[0]
\n"; print "Section Three.
\n"; print "The value of \$customer_get is: $customer_get.
\n"; print "The value of \$customer_post is: $customer_post.
\n"; my $customer = $_[0]; print "The value of \$customer (passed in to sub) is: $customer.
\n"; #Store the building names to variables for ($i = 0; $i<$#parameters; $i++) { #print $q->param($parameters[$i]) . "
\n"; if (($parameters[$i]) =~ /^building/) { my @buildings = push (@buildings,($q->param($parameters[$i]))); } } $j = scalar (@buildings); my @building_nums; for ($k = 1; $k<=$j; $k++) { push (@building_nums,$k); } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; for ($i = 0; $i<=$#buildings; $i++) { print "\n"; print "\n"; print "\n"; } print "\n"; print "
You entered the following building names. If they are correct, select 'Submit' to add them to the database for customer $customer
"; print ""; print "
"; print "Building $building_nums[$i]: $buildings[$i]"; print ""; print "
\n"; print "
"; } ######################## ADD BUILDING NAMES TO THE DATABASE TABLE ######################################## sub sectionFour() { } ##########################################################################################################