0

Hey everyone, I have a question about Perl CGI. I am creating a profile management system using Perl CGI for an assignment and am having a little trouble understanding to go about it. My code is written using subroutines and it interfaces with one another by calling a subroutine.

A Main loads and allows you to login after logging in you have to options update profile or delete. My problem is that every time I try to process the update forms it takes me back to the login page instead of updating the profile and displaying results.

Any advise on what I am doing wrong. I would enter my code but since its for a school project I am not sure its wise. But basically it goes like this. &login calls a account management page which allow you to update the data but I keep coming back to my main login everytime I click submit.

if ($ENV{REQUEST_METHOD} eq "GET")
{
        &print_form;
}
else
{
    # Validate form input
    my %errors = %{$cgi->errors()};

    # In case of errors, whow the form again with warnings
    # Otherwise complete registration
    if (%errors)
    {
        &print_form(\%errors);
    }
    else
    {
        &login();
    }
}

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Major Major
0

you've got your causality reversed in the first if statement.

if ($env eq "GET")
{
  validate();
}
else
{
  displayform();
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.