Ho to properly use strlen?

Posted 30 September 2012 - 10:17 AM

I am on the finishing end of my project and I need to verify that certain objects have a certain number of chars. and a number of digits. I am trying to use strlen and I believe it does that but it still outputs the error message even when the condition is met. I know it is some dumb mistake on my part but I cannot figure out where.
Starting at line 55

Replies To: Ho to properly use strlen?

Re: Ho to properly use strlen?

Posted 30 September 2012 - 10:26 AM

Most likely (I've given up reading code that mixes languages) you're checking a value that hasn't been submitted yet. That's the problem with mixing PHP and other languages like HTML, CSS, and Javascript. It's easy to forget the order in which things happen!

Re: Ho to properly use strlen?

Posted 30 September 2012 - 10:31 AM

I agree that mixing the two languages is very confusing, I go in and out of HTML and then throw some PHP into it it is very confusing especially when just starting out. I like your post on having HTML on one page and PHP on the other, once I make it through this I will have to try and use that method

Re: Ho to properly use strlen?

Posted 30 September 2012 - 08:54 PM

It's also kind of redundant to do if (empty(...) == TRUE). It's exactly the same thing as doing just: if (empty(...)). The == TRUE is implied in all boolean checks. - The only place where you need to compare something to TRUE is if you are doing strict comparisons, using three equal signs.