'ello.
I was hoping I wouldn't have so much trouble with one thing that I'd have to post to a forum about it. I guess you could say I'm self-conscious, and afraid that I'm missing something terribly obvious. So please, bear with me.
I am not a newb to programming (C++, Java, etc), but I am relatively new to PHP.
I am writing a script that processes a form used to post news articles to a database for use elsewhere on the site. This particular section of the code that I am having problems with checks each text field to see whether or not it is blank, assigns a short statement saying which fields need to be filled in to variables ($problem0, $problem1, $problem2) and if any of those variables are not blank (IE: Have an error message stored in them) executes a function that displays the error message(s) and re-displays the form.
Now, the part I'm having problems with is the "if" part of this. For some reason (and a reason I fear to be sickeningly obvious) it seems like PHP is ignoring the fact that I am saying "ONLY execute the function if $problem0, $problem1, and $problem2 have a string stored in them" and just executes the function anyway, displaying NO error messages. There is no reason it should be letting this if statement slip by as true from what I can see.
Now, believe me, I have tried my hardest to figure out what the problem is with this. $problem0, $problem1, and $problem2 are all set to blank before I run through the if statements to determine if fields in the form are blank. Plus, like I said, none of the error messages were displayed, and they DO display properly if the problem that the program should be looking for is actually found.
So, I'm confused and frustrated.
Without further adieu, my if statement...
if (problem0 != "" || problem1 != "" || problem2 != "")
{
redisplay_form($header, $article, $problem0, $problem1, $problem2);
exit();
}
Help is very, very much appreciated...