Re: Comparing strings

From: Date: Thu, 01 Nov 2001 10:18:14 +0000
Subject: Re: Comparing strings
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-73132@lists.php.net to get a copy of this message
In article <3BE1136F.5294A6B5@phantomcougar.com>, phantom@phantomcougar.com (Phantom) wrote: > In PHP I have tried > > if ($Action == "Submit") but I get a parse error in that statement. > What am I doing wrong? Thank you. I did an echo $Action to confirm > that it's value is Submit. If the variable is set as you've confirmed, then that should work. If PHP is reporting a parse error with that line number, note that the lines where PHP stopped parsing isn't necessarily the line where the bad code resides. Try checking back a few lines; you may have left off a semi-colon or somesuch. Another idea: check that the variable's length is the expected 5 chars; maybe there's some trailing whitespace that's causing the comparison to fail (trim() is handy for avoiding this gotcha). If neither of those solve the problem, try re-posting with a larger code snippet. -- CC

« previous php.general (#73132) next »