#!/usr/bin/perl require "subparseform.lib"; &Parse_Form; print "Content-type: text/html\n\n"; #currentodds---current tally of odds; #change--------the current change that will be applied to currentodds; #choice--------1, 2, 3, or 4; #value[x,y]----the change value for each possible answer; #question[x]---string of question, x is question number; #answer[x,y]---x is question number, y is 1st-4th answer numbers; $subject = $formdata{'subject'}; $choice = $formdata{'choice'}; $counter = $formdata{'counter'}; $change = $formdata{'value' . $counter . $choice}; $currentodds = $formdata{'currentodds'} + $change; if ($currentodds > 100) { $currentodds = 100; } if ($currentodds < 0) { $currentodds = 0; } $counter = $counter - 1; print "What are the odds that $subject"; print "
What are the odds that $subject\?

"; for ($i = 0; $i < 105; $i = $i + 5) { if ($i eq $currentodds) { print ""; } else { print ""; } } print "

"; for ($i = 1; $i < 5; ++$i) { $response[$i] = $formdata{'answer' . $counter . $i}; } $currentquestion = $formdata{'question' . $counter}; #---The Form--- # #It posts to this very script. #First it gives the 4 responses, assigning them value 1 thru 4 #It then reposts the contents of the hash, with the exception #of choice, currentodds, and counter (which are added seperately) if ($counter ne 0) { print "
"; print "$currentquestion\?

\n"; print "\n"; print "$response[1]
\n"; print "$response[2]
\n"; if ($response[3] ne "skip") { print "$response[3]
\n"; } if ($response[4] ne "skip") { print "$response[4]
\n"; } foreach $key (keys %formdata) { if (($key ne "choice") && ($key ne "currentodds") && ($key ne "counter")) { print "\n"; } } print "
"; print ""; print ""; print ""; print ""; } else { print "
The odds that $subject\: $currentodds\%

"; if ($currentodds > 66) { $theendhigh = $formdata{'theendhigh'}; print "$theendhigh

"; $picturehigh = $formdata{'picturehigh'}; print "

"; } if (($currentodds < 66) && ($currentodds > $33)) { $theendmiddle = $formdata{'theendmiddle'}; print "$theendmiddle

"; $picturemiddle = $formdata{'picturemiddle'}; print "

"; } if ($currentodds < 33) { $theendlow = $formdata{'theendlow'}; print "$theendlow

"; $picturelow = $formdata{'picturelow'}; print "

"; } } print "Click here to go the main What Are The Odds? page.
"; print "Click here to go back to start.

"; print "Click here to laugh at my pathetic PERL source code."; 1;