navwin » Tech Talk » Beyond the Basics » "Action" Input and Conditionals
Beyond the Basics
Post A Reply Post New Topic "Action" Input and Conditionals Go to Previous / Newer Topic Back to Topic List Go to Next / Older Topic
Christopher
Moderator
Member Rara Avis
since 1999-08-02
Posts 8296
Purgatorial Incarceration

0 posted 2002-12-14 05:44 AM


Cannot understand where I'm having a problem here, and it's something I really would like to have, so I don't end up with a different script for everythign I want to do.

This should simply print a form if it receives no $action" or print a single line if it receives the $action of "login."

No matter what I do, it gives me the form each and every time and I can't, for the life of me, see why. I appreciate any hints!

**********


#!/usr/local/bin/perl
require "toolbox.pl";

inputIn();

$email = $input{'email'};
$password = $input{'password'};
$action = $input{'login'};

if (! $action) {printForm();}
elsif ($action eq "login") {
            header();
            print qq~Action = $action~;
            footer();
        }


#####################
#####SUBROUTINES#####
#####################

#Print HTML form to login with
sub printForm {
    header();
    print qq~<form method="post" action="login.pl">
<div align="center">
<table width="350" bgcolor="#6699cc" cellpadding="0" cellspacing="0" border="0">
   <tr>
    <td height="30" valign="bottom">
<img src="imgs/1.gif" width="1" height="1" hspace="35"><strong>Email Address</strong>
</td>  
   </tr>
   <tr>
    <td height="30" valign="top">
<img src="imgs/1.gif" width="1" height="1" hspace="35"><input type="text" name="email" size="30" maxlength="50" value="">
</td>  
   </tr>
   <tr>
    <td height="30" valign="bottom">
<img src="imgs/1.gif" width="1" height="1" hspace="35"><strong>Password</strong>
</td>
   </tr>
   <tr>
    <td height="30" valign="top">
<img src="imgs/1.gif" width="1" height="1" hspace="35"><input type="password" name="password" size="30" maxlength="50" value="">
    <input type="hidden" name="action" value="login">
    <br>
</td>  
   </tr>
   <tr>
    <td height="10" valign="top">
<br>
    <div align="center"><input type="submit" value=" Submit "><input type="reset" value=" Reset "></div>
<br>
</td>  
   </tr>
   </table>~;
   footer();
}#End SR printForm

[This message has been edited by Christopher (12-14-2002 05:46 AM).]

© Copyright 2002 C.G. Ward - All Rights Reserved
Christopher
Moderator
Member Rara Avis
since 1999-08-02
Posts 8296
Purgatorial Incarceration
1 posted 2002-12-14 07:25 AM


I wonder if I can set a timer letting me know when I should stop looking at the code because I'm not paying attention to the right things?

Nevermind - I figured it out.

$action = $input{'action'};

uhm - duh.

Post A Reply Post New Topic ⇧ top of page ⇧ Go to Previous / Newer Topic Back to Topic List Go to Next / Older Topic
All times are ET (US). All dates are in Year-Month-Day format.
navwin » Tech Talk » Beyond the Basics » "Action" Input and Conditionals

Passions in Poetry | pipTalk Home Page | Main Poetry Forums | 100 Best Poems

How to Join | Member's Area / Help | Private Library | Search | Contact Us | Login
Discussion | Tech Talk | Archives | Sanctuary