i'm having problems getting the following to work. can u see anything obvious that might be the culpret.
#!/usr/local/bin/perl -W use CGI qw(standard); use CGI::Carp qw(fatalsToBrowser); use DBI; use Getopt::Std; use CGI::Request; ##initialise oracle connection $ENV{‘ORACLE HOME’)= ‘/oracle/uo1’; $host = “neptune”; $sid = “ora1”; $user = “tayloja1”; $password = “the.best”; $sport = ‘basketball’; my $cgi = new CGI::Request; my $year =$cgi->param("year"); my %teams; $teams{"team$_"} = param("team$_") for 1..11; foreach $team (keys %teams) { If ($team ne ‘please specify’){ Push @list1,$team1; } } ##Once the list is created I need to randomise the array. $firstrandom = $list1 [rand @list1]; Push @list2, $random; $count = $#list1 while ($count != 0){ ###create list2 $random = $list1 [ rand @list1]; $present = “false”; For $I (0..$#list2){##check to see if team is already in list If ($random == $list2[$I]) { $Present == ‘true’; }; If ($Present == ‘false’) { ##if not add it to @list2 Push @list2, $random; $count--; }; }; Database creation ## connect to oracle database. my $dbh = DBI->connect( "dbi:Oracle:host=$host;sid=$sid",$username, $p +assword) || die "Can't connect to Oracle"; For $I (0..$#list2) { $teampos = $I + 1; my$sth = $dbh->do("INSERT INTO results VALUES('$year',‘$sport’,‘$list2 +[$I],‘0’)") || die "Can't execute SQL insert results statement"; my$sth2 = $dbh->do("INSERT INTO trees VALUES('$year',‘$sport’, ‘$teamp +os’,‘$list2[$I]’,‘0’)") || die "Can't execute SQL insert trees statem +ent"; For $I (1..$#list2){ $teampos = $I + $#list2+1; my$sth3 = $dbh->do("INSERT INTO trees VALUES('$year',‘$sport’, ‘$teamp +os’,‘TBA’,‘0’)") || die "Can't execute SQL insert trees statement"; } my $compsize = $#list2+1; my $sth4 = $dbh->do("INSERT INTO compsize VALUES('$year',‘$sport’, ‘$c +ompsize’)") || die "Can't execute SQL insert results statement"; my $sth5 = $dbh->prepare("SELECT round, teamname, score from trees whe +re sport = ‘$sport’ and year = ‘$year’, ORDER BY round DESC") || die +"Can't prepare SQL get data statement"; $sth5->execute || die “can’t execute sql statement”; ##need to get all the data one row at a time from the table. my @row; $rowcount = 0; while (@row = $sth5->fetchrow_array()) { $round = $row[0]; $teamname = $row[1]; ## need to put each row into the list. $Score = $row[2]; of lists a variable at a time push (@{list_of_teamdata[$rowcount]}, qw($round $teamname $score); $rowcount++; } my $compsize = $#list2+1; If ($compSize = 7); Print “Content-Type: text/html\n\n”; Print “<html>\n”; Print “<head>\n”; Print “<title> tree7</title>\n”; Print “</head>\n”; Print “<body>\n”; Print “<table border="1" width="100%">\n”; Print “<tr>\n”; Print “<td width="9%">&nbsp;</td>\n”; Print “<td width="9%">&nbsp;</td>\n”; Print “<td width="9%">&nbsp;</td>\n”; Print “<td width="9%"><b><P align=center><SELECT name=Team7 size=1>\ +n”; Print “<OPTION selected value=101>$list_of_teamdata [6][1]</OPTION>\ +n”; Print “<OPTION value=103>Business School</OPTION>\n”; Print “<OPTION value=103>Admin/Estates</OPTION>\n”; Print “<OPTION value=104>CEAC </OPTION>\n”; Print “<OPTION value=105>Civ Eng</OPTION>\n”; Print “<OPTION value=106>Combined Honours</OPTION>\n”; Print “<OPTION value=107>CSAM</OPTION>\n”; Print “<OPTION value=108>EEAP</OPTION>\n”; Print “<OPTION value=109>MechEng</OPTION>\n”; Print “<OPTION value=110>ModLang</OPTION>\n”; Print “<OPTION value=111>Vision Sciences</OPTION>\n”; Print “<OPTION value=112>Pharmacy</OPTION>\n”; Print “&nbsp;</SELECT>\n”; Print “</P>\n”; Print “</td>\n”; Print “</b>\n”; Print “</td>\n” Print “<td width="9%"><b><P align=center><SELECT name=score7 size=1> +\n”; Print “<OPTION selected value=101>$list_of_teamdata [6][2]</OPTION>\ +n”; Print “<OPTION value=103>0</OPTION>\n”; Print “<OPTION value=103>1</OPTION>\n”; Print “<OPTION value=104>2</OPTION>\n”; Print “<OPTION value=105>3</OPTION>\n”; Print “<OPTION value=106>4</OPTION>\n”; Print “<OPTION value=107>5</OPTION>\n”; Print “<OPTION value=108>6</OPTION>\n”; Print “<OPTION value=109>7</OPTION>\n”; Print “<OPTION value=110>8</OPTION>\n”; Print “<OPTION value=111>9</OPTION>\n”; Print “<OPTION value=112>10</OPTION>\n”; Print “<OPTION value=113>11</OPTION>\n”; Print “<OPTION value=114>12</OPTION>\n”; Print “&nbsp;</SELECT>\n”;

In reply to cgi problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.