DOH!

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
Chonk
Forum Newbie
Posts: 24
Joined: Fri May 28, 2004 3:58 am

DOH!

Post by Chonk »

Just posting to see what the most annoying error/problem you had was and how long it took to solve. Mine recently happend when i was checking 2 POST variables like this :

Code: Select all

<?php
if(!isset($_POST['uname']) && !isset($_POST['pass']))
{
  //FORMS
}
elseif(!isset($_POST['uname']) || !isset($_POST['pass']))
{
echo "Not all data entered please check";
}
elseif(isset($_POST['uname'] && isset($_POST['pass']))
{
 echo "Data entered";
}

?>
When only one variable was set "data entered" would be shown. It took me 4-5 days(after skating around the problem and coding something else ) before i realised what was wrong. I guessed that the POST variable must be setting some nullbyte value which isset would actually identify. A quick change to is_empty and I was done :D
Last edited by Chonk on Tue Jul 06, 2004 5:20 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

redundant? :? :arrow: Annoying Poll
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

elseif(isset($_POST['uname'] && isset($_POST['pass'])

You never closed the elseif.
Chonk
Forum Newbie
Posts: 24
Joined: Fri May 28, 2004 3:58 am

Post by Chonk »

feyd: You are completly right, i should of read through a few pages first :oops:

LiLpunkSkateR: Your right about the code i posted but the code I had the problem with was the correct syntax.
Post Reply