Page 1 of 1

Check for empty fields script

Posted: Tue Aug 04, 2009 1:57 pm
by crazymao
ok so i have created a form which checks for empty fields

if (empty($username) || empty($password)) {
include "loginpage.php";
echo "Please fill in all the fields";
} else {

but the problem is that even if i fill in all the fields it still gives my the message.

Re: Check for empty fields script

Posted: Tue Aug 04, 2009 2:01 pm
by jackpf
What's the whole script?

Re: Check for empty fields script

Posted: Tue Aug 04, 2009 9:04 pm
by Haddman
It would be better to see a bit more of the script but try this:

Code: Select all

 
if(!isset($_POST['username']) || !isset($_POST['password'])){
 echo "Please fill in all the fields";
}else{
........