CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
calling a defined error file



Jul 26, 2001, 3:53 PM

Post #1 of 1 (878 views)
calling a defined error file Can't Post

In my new script I am offer the option for users to use register and login forms that the script defines. Wherein, the cgi prints our the page with the form and when submitted it calls on a subroutine of itself.

I made it so that the user can also have a register and login HTML pages and of course the form action calls upon the same subroutine that the cgi version would use. So if a user wants a QUICK solution, they can change the color values such as $bgcolor and $textcolor. And the cgi will create if for them, or they can take the time and create their own HTML files to match their site better.

I have a question about the error subroutine in the login subroutine.

Within sub login I have &error
and then:

sub error {
($error) = @_;
print $a->header();
print $a->start_html(-title=>'Error!', -bgcolor=>$bgcolor, -text=>$text, -link=>$link, -alink=>$alink, -vlink=>$vlink);
print "I am sorry, but $error. Go <a href=\"javascript:history.back(1)\">back and correct the error.\n";
print $a->end_html;

Of course if the script returns an error in the login information, it will post this "page" This works fine for anyone who just uses the forms created by the cgi, but it doesn't match the layout of the login.htm and register.htm for those who want to define their own forms.

I have created error.htm which has the same information, but it is formatted in the same tables and colors as the register.htm and login.htm. Any ideas as to the best way to change &error to get it to call up error.htm.

You do not have to worry about making the code so that it can print both the error page from cgi AND the error.htm file. I have created to versions of the script so far. The user would download one version if they wanted the fast solution which would print out all the forms contained in the cgi. And if they want more customization and use the HTML files instead, then they can download the version which will have the &error set to send them to the error.htm page. Hopefully I described this well enough to explain how I wanted to. Thank you in advance for any ideas that you might have.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives