First of all. You should always provide the whole code, eg. in format of PHPFiddle.
Secondly, you should not mix HTML and PHP.
Also your problem cannot be deciphered from your question, because there might be several reasons. Like the city name could be in uppercase or capitalized in your session variable.
Your session variable might not be initialized with your session in the class constructor.
Also you might even not have a class at all, so the reference to $this would be obsolete.
But those aside, here's a code that might help you:
<?php
class MockSession {
function __construct() {
}
}
class Foo {
function __construct() {
$this->session = new MockSession();
$this->session->city = "Helsinki";
}
function printSelect() {
$result = array("London","New York","Helsinki");
echo '<select>';
foreach ($result as $city) {
$sel = '';
echo $city." ".$this->session->city;
if (strtolower($city)==strtolower($this->session->city)) {
$sel = ' selected="selected" ';
}
echo '<option value="'.$city.'" '.$sel.'>'.$city.'</option>';
}
echo '</select>';
}
}
$foo = new Foo();
$foo->printSelect();
?>