i have a script to take the input from 13 drop down boxes of team names and 13 boxes of their scores over a competition tree. if the same teamname is entered then the respective score variables updates the score where that team is in the database. i set up a hash to hold the variables and it seems like there are no values being passed to the variables. the code for the html source for a pair of variables is below.
print "<td width=\"9%\"><b><P align=center><SELECT name=team1 size=1>\ +n"; print "<OPTION selected>$list_of_teamdata[0][1]</OPTION>\n"; print "<OPTION>Business School</OPTION>\n"; print "<OPTION>Admin/Estates</OPTION>\n"; print "<OPTION>CEAC </OPTION>\n"; print "<OPTION>Civ Eng</OPTION>\n"; print "<OPTION>Combined Honours</OPTION>\n"; print "<OPTION>CSAM</OPTION>\n"; print "<OPTION>EEAP</OPTION>\n"; print "<OPTION>MechEng</OPTION>\n"; print "<OPTION>ModLang</OPTION>\n"; print "<OPTION>Vision Sciences</OPTION>\n"; print "<OPTION>Pharmacy</OPTION>\n"; print "&nbsp;</SELECT>\n"; print "</P>\n"; print "</td>\n"; print "</b>\n"; print "<td width=\"9%\"><b><P align=center><SELECT name=score1 size=1> +\n"; print "<OPTION selected>$list_of_teamdata[0][2]</OPTION>\n"; print "<OPTION>0</OPTION>\n"; print "<OPTION>1</OPTION>\n"; print "<OPTION>2</OPTION>\n"; print "<OPTION>3</OPTION>\n"; print "<OPTION>4</OPTION>\n"; print "<OPTION>5</OPTION>\n"; print "<OPTION>6</OPTION>\n"; print "<OPTION>7</OPTION>\n"; print "<OPTION>8</OPTION>\n"; print "<OPTION>9</OPTION>\n"; print "<OPTION>10</OPTION>\n"; print "<OPTION>11</OPTION>\n"; print "<OPTION>12</OPTION>\n"; print "&nbsp;</SELECT>\n"; print "</P>\n"; print "</td>\n"; print "</b>\n";
the form works the submit works there are no syntax errors comming up from the debugger.
#!/usr/local/bin/perl use DBI; use CGI qw(:standard); print header; print start_html; $ENV {'ORACLE_HOME'}= '/oracle/u01'; $host="??"; $sid="???"; $username="?????"; $password="??????"; $sport = 'basket ball'; $dbh = DBI->connect( "dbi:Oracle:host=$host;sid=$sid",$username, $pass +word)|| die "Can't connect to Oracle"; $sth = $dbh->prepare("SELECT year from trees WHERE sport = \'$sport\' +AND year = \'$year\'")|| die "couldn't prepareSQL statement"; $sth->execute || die "can't execute sql statement"; my @row; while (@row = $sth->fetchrow_array()) { $year = $row[0]; } $sth2 = $dbh->prepare("SELECT teamno from compsize WHERE sport = \'$s +port\' AND year = \'$year\'")|| die "couldn't prepareSQL statement"; $sth2->execute || die "can't execute sql statement"; my @row2; while (@row2 = $sth2->fetchrow_array()) { $compsize = $row2[0]; } if ($compsize == 7){ my $cgi = new CGI; my %teams; $teams{"team$_"} = $cgi->param("team$_") for 1..($compsize * 2) - 1; my %scores; $scores{"score$_"} = $cgi->param("score$_") for 1..($compsize * 2) - 1 +; } print "<table border=1> \n"; print "<tr> \n"; print "<th> List of info </th> \n"; print "<tr> \n"; for $team(keys %teams){ print "<tr> \n"; print "<td>$team </td> \n"; print "</tr> \n"; } for $team(keys %teams){ print "<tr> \n"; print "<td>$team</td> \n"; print "</tr> \n"; } for $score(keys %scores){ print "<tr> \n"; print "<td>$score </td> \n"; print "</tr> \n"; } my $teampos; for $i (1..($compsize * 2) - 1 ){ for $team(keys %teams){ $teampos = $I; my $row1 = $dbh->do("UPDATE trees SET department = /'$team/', WHERE ro +und = /'$teampos/'") || die "Can't execute SQL update statement 1"; my $row2 = $dbh->do("UPDATE results SET score = /'$score/', WHERE year + = /'$year/' AND sport = /'$sport/' AND department = /'$team/'") || d +ie "Can't execute SQL update statement 2"; } for $score (keys %scores){ $teampos = $I; my $row3 = $dbh->do("UPDATE trees SET score = /'$score/', WHERE round += /'$teampos/'") || die "Can't execute SQL update statement 3"; } } print "<tr> \n"; print "<td>all done </td> \n"; print "</tr> \n"; print "</table>"; print "</body>"; print "</html>";
i know the oracle statements are just about right. can u help???

In reply to script problems1 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.