Problem with strlen command

Hi,

I have spent the last few hours trying to work out what is wrong with a PHP script I have been writing. Basically, I am trying to get the script to check that each entry on form entry is filled out and a suitable length. Here is where the problem occurs:

if (preg_match($pattern,$email) > 0
&& (strlen($username)>6) && (strlen($username)<20)
&& (strlen($password)>6) && (strlen($password)<20)
&& !empty($title)
&& (strlen($firstname)>1) && (strlen($firstname)<40)
&& (strlen($surname)>2) && (strlen($surname)<40)
&& (strlen($institution)>2) && (strlen($institution)<80)
&& !empty($country) && !empty($terms) )

The script is passed if I remove all but any one of the “strlen” statements, and each of the strlen statements I am running elsewhere in the page individually and are passing okay.

Can anyone suggest what I am doing wrong? I guess it is something very basic but I have no idea.

Can you try using error_reporting() (see also my signature)?

Sponsor our Newsletter | Privacy Policy | Terms of Service