title: How to change background with php and css
body: <p>I have a php and html code and I have this</p>
  
  <pre><code>&lt;?php
  
  if (!$_SESSION['login']) {
      $favicon = 'favicon.ico';
      $logo = 'logo';
      $bg = 'bg';
  } elseif ($_SESSION['sex'] === 'Hombre') {
      $favicon = 'faviconh.ico';
      $logo = 'logoh';
      $bg = 'bgh';
  } else {
      $favicon = 'faviconm.ico';
      $logo = 'logom';
  ?&gt;
  
  &lt;body&gt;
  
  etc
  </code></pre>
  
  <p>How I can put the bg var to put the background image with the if?</p>
  
  <p>I try to put &lt;?php echo 'background-image id="'.$bg.'"'; ?&gt;&gt; but doesn't work.</p>
  
  <p>I have 3 Css so in the if when I put bg or bgh or bgm I am taking one background image or another or another.</p>
  
  <p>Ant solution?</p>
  
  <p>The css is </p>
  
  <pre><code>.bg {
  backgroun-image: URL ('../img/bg.jpg');
  }
  
  .bgh {
  backgroun-image: URL ('../img/bgh.jpg');
  }
  
  .bgm {
  backgroun-image: URL ('../img/bgm.jpg');
  }
  </code></pre>