Output just the background color, just an image or both together
<p>On my template I have a field where the user(s) can choose and select a background for their site.</p>

<p><img src="http://i.stack.imgur.com/foglZ.png" alt="enter image description here"></p>

<p>This is called from the ID <code>background-one</code> in an array. </p>

<p>My question is, how would I be able to output this into the head section of my CSS correctly if the users are only given the following options:</p>

<p>1) The choice of just a background color</p>

<blockquote>
  <p>background: #990000;</p>
</blockquote>

<p>2) The choice of just a background image</p>

<blockquote>
  <p>background: url(../images/example.jpg) no-repeat top left scroll;</p>
</blockquote>

<p>3) Or the choice of a background color and an image</p>

<blockquote>
  <p>background: #990000 url(../images/example.jpg) no-repeat top left scroll;</p>
</blockquote>

<hr>

<p>This is my current snippet of code to output the script into the css head section:</p>

<pre><code>&lt;?php $background = of_get_option('background-one'); {  
    if ($background['color'] || $background['image']) {
        echo 'body {
        background: ' . $background['color'] . ' url(' . $background['image']. ') ' .$background['repeat']. ' ' .$background['position']. ' ' .$background['attachment']. ';';
    }

    else if ($background['color']) {  
        echo 'body {
        background: ' . $background['color']. ';';
    }

    else if ($background['image']) {
        echo 'body {
        background: ' . 'url(' . $background['image']. ') ' .$background['repeat']. ' ' .$background['position']. ' ' .$background['attachment']. ';';
    };
}
?&gt;
</code></pre>

<p>But with that, the results are:</p>

<p>1) The choice of just a background color</p>

<blockquote>
  <p>background: #990000 url() no-repeat top left scroll;</p>
</blockquote>

<p>2) The choice of just a background image</p>

<blockquote>
  <p>background: <code></code>url(../images/example.jpg) no-repeat top left scroll;</p>
</blockquote>

<p>3) Or the choice of a background color and an image</p>

<blockquote>
  <p>background: #990000 url(../images/example.jpg) no-repeat top left scroll;</p>
</blockquote>

<p>As I'm fairly new to writing PHP, how would I re-work my snippet above to get the results I'm after?</p>
