Re: How to use what the function returns?

From: Janwillem Borleffs (jw_at_jwscripts.com)
Date: 01/23/05


Date: Sun, 23 Jan 2005 23:16:53 +0100

varois83 wrote:
> Now below is the area in my code where I have to fit what that
> function returns but I can't do it. The "Text" field is the one that
> has to be checked for a certain length (Like $min = 1, $max = 100).I
> would like to point to the error.html file if checkLength returns
> false.
>
> $Text = $_POST['Text'] ;
> $email = $_POST['email'] ;
> $name = $_POST['name'] ;
>
> if (empty($name) || empty($email)) {
> header( "Location: error.html" );
>

if (!checkLength($Text, 1, 100) || empty($name) || empty($email)) {
    ....
}

BTW, there's more to form validation than used in this code (per example, it
will allow a single white space character to pass as a valid email address),
but you will probably get to this when you have learned more about PHP.

JW



Relevant Pages

  • Re: Improved popup window
    ... This due to poor javascript code used in this popup. ... If you want to size your window to fit the image from php you could ...
    (comp.lang.php)
  • Re: Improved popup window
    ... This due to poor javascript code used in this popup. ... If you want to size your window to fit the image from php you could ...
    (comp.lang.php)
  • Re: Improved popup window
    ... the popup window is not resized to fit image ... This due to poor javascript code used in this popup. ... from php. ...
    (comp.lang.php)
  • Re: Tool to parse and validate PHP script?
    ... can fit in the SSH terminal window, and that caused a run-time error ... You can run 'php -l thescript.php' to do a syntax check, ...
    (comp.lang.php)
  • help with regular expression interpretation
    ... p.s Sorry if my previous post "can i get the public key of client ... machine using php" didn't fit right into USENET, i am very very new here ...
    (comp.lang.php)