If the database field is not filled in how to make the selection fields are filled and unfilled?

I have a form in which a dropdown list of cities here it is
 <select name=city>
<option value=https://msk.nuipogoda.EN>Moscow</option>
<option value=https://spb.nuipogoda.EN>Saint Petersburg</option>
<option value=>No city in the list</option>

In the table data is stored with a third-party site but when there is no city in the list I made blank. Now how do I make a distinction between blank and completed how to write an if statement to blank?
Here's the instruction but it doesn't work, I threw $_POST['city'] in the session:
if($_SESSION['city']==null) //ie if the field is empty

In the table structure I only have city / VARCHAR / 40 (there is a field NULL may add it)
March 23rd 20 at 18:58
1 answer
March 23rd 20 at 19:00
In fact, the question has already been answered in the comments:
if ($_SESSION['city']==") {
 // Field is empty
} else {
 // Field is filled

It is better to install in DB city field equal to an empty string and not NULL, so there was no confusion. Then there will be one mapping between the database and the value in the field.
Next, suggest to use PHP function, not mysql, and mysqli, which at times work out faster. Works with the same mysql database and same queries, only the function syntax is a little different. Free share its function for convenient operation:
$dbHost = 'localhost';
$dbName = '...';
$dbUser = 'root';
$dbPassword = '...';
$mysqli = new mysqli($dbHost, $dbUser, $dbPassword, $dbName);
if ($mysqli->connect_errno) {
 echo "failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
 * The query to MySQL
 * @param string $query - the query
 * @param string $type - the type of function execution
 * "many" (default) - to return multiple rows. Returns a two-dimensional array
 * "one" - to return a single row. Returns an array
 * "count" to return a count of rows. Returns the number recorded in line
 * "do" - to carry the team. Returns true in case of successful execution in case of error, outputs the error text.
 * others: returning one value one row
 * @return array|string|bool
function query($query, $type="many") {
 global $mysqli;
 if (!$result = $mysqli->query($query)) {
 return mysqli_error($mysqli);
 if ($type == "do") {
 return true;
 $values = [];
 while ($row = $result->fetch_assoc()) {
 $values[] = $row;
 if ($type == "count") {
 return $values[0]["COUNT(*)"];
 } elseif ($type == "one") {
 return $values[0];
 } elseif ($type == "many") {
 return $values;
 } else {
 return $values[0][$type];

Find more questions by tags PHP