|
Posted by dombi on 07/01/06 01:30
My website is based on some CMS sytem. From there I am getting a string
value passed into php, which I would like to compare to two possible
choices. The result of this comparison would be used to set a dropdown
menus selected option. For some reason I cannot do this right. I think
it might have something to do with foreign characters that I am using,
althogh I am not 100% sure...
Here is what I have.
$localvar = array("{string variable from CMS}"); // this comes
from the CMS and is either "kereskedő" or "magánszemély"
$choices = array("kereskedő", "magánszemély"); // this is just a
preset array with the two possibilities
echo '<select name="yourtype">'; // setting up
the pulldown menu
foreach ($choices as $value) {
echo "<option value=\"" . $value . "\"";
if ( $value === $localvar[0] ) echo " selected";
echo ">" . $value . "</options>";
}
echo '</select><br />';
If I echo $localvar[1] out I do get either 'kereskedő" or
"magánszemély", but when it passed through the conditional, it always
fails. What could be going on here?
Thanks in advance!
dombi
Navigation:
[Reply to this message]
|