rendered paste body$departure_2 = $_POST['destination_2']; $query = "SELECT id, region, main_location, specific_location FROM locations WHERE id='".mysql_escape_string($departure_2)."'"; $result = mysql_query($query, $link); while($row=mysql_fetch_array($result)) { if ($row['specific_location']) { $departure_2_text = $row['specific_location']; } if (($row['main_location']) && (!$row['specific_location'])) { $departure_2_text = $row['main_location']; } if (($row['region']) && (!$row['main_location']) && (!$row['specific_location'])) { $departure_2_text = $row['region']; } $departure_2_text = $row['specific_location']; }