Kill border by using PHP?
One way would be to set a minimum height on #banner. That way when #banner is empty of content, there will still be a space between #menu and the border. This solution does not require you to involve PHP at all.

#banner {
  min-height: 10px;
}