Hi!
Sorry if I'm being a pain. I'm teaching myself perl so I'm not sure what you're needing.
What's happening when I run the script is that the page does not display in the browser. The browser simply sits and displays nothing but a blank screen when the script is called directly from the location box of the browser.
This is the message that I'm getting in my log relating to the file. I'm not sure where I would find the error message that you're speaking of. I'm using the sambar server on my computer and serving the documents out of it.
127.0.0.1 - - [05/Apr/2004:23:24:42 -0400] "GET /cgi-bin/homeblood.pl? +datedata=04%2F01%2F04&eaten=no&timedata=8%3A30&shift=am&readdata=110 +HTTP/1.1" 200 0 125 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en- +US; rv:1.5) Gecko/20031007"
I'm afraid that I don't know what it means.
The code for the full script I'm creating is:
#!/usr/bin/perl require "subparseform.lib"; &Parse_Form; print "<HTML>\n<HEAD>\n<TITLE>Home Blood</title>\n</head>\n"; print "<BODY>\n"; print "<FORM name='blood' method='get' action='homeblood.pl'>\n"; print "<TABLE cellspacing=10 cellpadding=5>\n"; print "<TR>\n"; print "<TD>\n"; print "Date: <INPUT type='text' name='datedata' size=8 value='04/01/04 +'>\n AE: no <INPUT type='radio' value='no' name='eaten' checked> y +es <INPUT type='radio' value='yes' name='eaten'><BR>\n"; print "Time: <INPUT type='text' name='timedata' size=5 value='8:30'>\n + am <INPUT type='radio' value='am' name='shift' checked> pm <INPUT + type='radio' value='pm' name='shift'><BR>\n"; print "Read: <INPUT type='text' name='readdata' size=3 value='110'> <I +NPUT type='submit' value='save reading'>\n"; print "<BR><BR>"; # ROUTINE TO MOVE INPUT FILE 'BLOODSUGAR.DAT' TO ARRAY WORKFILE open (workfile, "<bloodsugar.dat"); # opening b +lood sugar file as input @workfile = <workfile>; # moving inp +ut file reads to the array 'workfile' close(workfile); # closing fi +le print "Check 1: Last index for workfile: $#workfile<BR>"; if ($#workfile = -1) { print "<B>\ \ \ \ INPUT file is not present</b +><BR>"; } # END MOVE ROUTINE # DEFINE SCRIPT VARIABLES $datecomp = $formdata{'datedata'}; $count = 0; $founddex = "no"; $fountarraydex = 0; $am_or_pm = $formdata{'shift'}; $looptrip = 1; print "Check 2: shift is ' $am_or_pm '<BR>"; # END OF SCRIPT VARIABLE DEFINITION # LOOP TO CHECK FOR EXSISTING RECORD if ($#workfile = -1) { print "Loop check is skipped because of no input file<BR>" } else { foreach $listing (@workfile) { ($arraydate, $morntime, $mornread, $morneaten, $noontime, $noo +nread, $nooneaten) = split(/-/, $listing); print "Array Date is: $arraydate<BR>"; if ($arraydate eq $datecomp) { print "Check 3: (date compare) $arraydate vs $datecomp<BR +>"; if ($am_or_pm eq "am") { $morntime = $formdata{'$timedata'}; $mornread = $formdata{'$readdata'}; $morneaten = $formdata{'$eaten'}; } else { $noontime = $formdata{'$timedata'}; $noonread = $formdata{'$readdata'}; $nooneaten = $formdata{'eaten'}; } $foundarraydex = $count; $founddex = "yes"; $count = $count + 1; $amendedrecord = $arraydate."-".$morntime."-".$morneaten. +"-".$noontime."-".$noonread."-".$nooneaten; print "Amended Record: $amendedrecord<BR>"; $workfile[$foundarraydex] = $amendedrecord; } print "Loop Cycled<BR>"; } print "<B>No Matching Record</b><br>"; } # END LOOP # ROUTINE FOR NEW RECORD print "New Record Routine<br>Founddex = $founddex<BR>" if ($founddex eq "no") { if ($am_or_pm eq "am") { $morntime = $formdata{'$timedata'}; $mornread = $formdata{'$readdata'}; $morneaten = $formdata{'$eaten'}; $noontime = "N/A"; $noonread = "N/A"; $nooneaten = "N/A"; } else { $noontime = $formdata{'$timedata'}; $noonread = $formdata{'$readdata'}; $nooneaten = $formdata{'eaten'}; $morntime = "N/A"; $mornread = "N/A"; $morneaten = "N/A"; } $appendedrecord = $arraydate."-".$morntime."-".$mornread."-".$morn +eaten."-".$noontime."-".$noonread."-".$nooneaten; $newdex = $#workfile; ++$newdex; $workfile[$newdex] = $appendedrecord; print "new record check<BR>"; } #open (extfile, ">>bloodsugar.dat"); #@workfile = sort{$b comp $a}(@workfile); #foreach $outputrec (@workfile) # { # print extfile "$outputrec/n"; # } # END NEW RECORD ROUTINE # DISPLAY LOOP FOR ARRAY'S ENTIRES #foreach $listing (@workfile) #{ #($morndate, $morntime, $mornread, $morneaten, $noontime, $noonread, $ +nooneaten) = split(/-/, $listing); #print "<B>$morndate $morntime a.m. $mornread | $noonread $noontime p. +m.</b><BR>"; #} # END LOOP # BEGIN ROUTINE TO PRINT STATIC PORTION OF WEB PAGE print "\n</td>\n"; print "<TD bgcolor='black'> </td>\n"; print "<TD>\n"; print "<A href='https://www.walgreens.com/login.jhtml;jsessionid=02BYQ +21BYH1GOCSJY2ZHQHQKJHDTE3MK?_requestid=260455'><IMG src='file:///c:/s +ambar53/docs/testing/images/walgreens.gif' height='26' width='190' bo +rder=0></a>\n"; print "<A href='http://channels.netscape.com/ns/atplay/default.jsp' st +yle='position:absolute; top:25px; left:500px;'><IMG src='file:///C:/s +ambar53/docs/testing/images/logo_ns40.gif' height='43' width='156' bo +rder=0></a>\n"; print "</td>\n"; print "</tr>\n"; print "</table>\n"; print "</form>\n"; print "</body>\n"; print "</html>\n"; # END ROUTINE
In reply to Re: Re: Conditional is stopping script
by heretic
in thread Conditional is stopping script
by heretic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |