|
Posted by Ed Jay on 12/17/97 11:31
I generate a page using a Perl script ("Page 1"). The page has a
multi-question form that is submitted to a second Perl script that creates
the next page ("Page 2").
Page 1 has a couple of questions that assigns values (0 or 1) to variable
$A and to variable $B. $A and B$ cannot each have the value 1. I'm trying
to trap the potential input error that results in $A = $B = 1.
Clearly I can submit the form values to Page 2 and have Page 2 test for
the error, print an error message and have the operator press a button to
return to Page 1. IOW, read all variables sent from Page 1, test for the
error, and if the error exists use a form to resubmit the form to
Page 1, otherwise continue to process Page 2, as follows:
E.g.,
Submit Page 1 variables to Page 2
Page 2 reads in variables from Page 1
if ($A && $B != 1) {process Page 2} #then goto Page 3
else {
print the error message
<FORM ACTION=cgi-bin/page_1.cgi\" METHOD=\"POST\">
<input type=submit value="Press here to go back to Page 1">
}
I'd prefer to have the form automatically proceed back to Page 1 if
there's an error instead of having the op press another button..
Two questions:
1. How can I either test the error while still on Page 1?
2. How do I test for the Page 1 error on Page 2 and automatically return
the op to Page 1 for corrections?
Thanks.
--
Ed Jay (remove M to respond by email)
[Back to original message]
|