http://www.perlmonks.org?node_id=181613


in reply to Checking for empty CGI params; this isn't working

You're checking the truth-value of the 'length' of an 'or' of two calls to 'param()' - this is probably not what you meant (-;

elsif ( (length(param('tele') > 0) or (length(param('mobile') > 0) )

might be closer to your intentions. Any views on optimum indentation style for code readability?


--
Anthony Staines

Replies are listed 'Best First'.
Re: Re: Checking for empty CGI params; this isn't working
by andrew (Acolyte) on Jul 14, 2002 at 18:01 UTC
    syntax error at /var/securewww/virtual/webewebin.com/a/signup.cgi line + 61, near ") {" syntax error at /var/securewww/virtual/webewebin.com/a/signup.cgi line + 76, near "}" (Might be a runaway multi-line ~~ string starting on line 73) Execution of /var/securewww/virtual/webewebin.com/a/signup.cgi aborted + due to compilation errors.
    I get that error from
    elsif ((length(param('tele') > 0) || (length(param('mobile') > 0)) { error("You need to enter either a telephone or a mobile"); }
    </code>

      elsif ( (length(param('tele')) > 0) || (length(param('mobile')) > 0) ) { .. }
      you've simply missed a brace each after 'tele' and 'mobile' :-)

      Have a nice day
      All decision is left to your taste

        this is what happens, when I dont enter anything in both I pass, but if I do enter something I get the error, how is it backwords