title: "Trying to get properties on a non-object" in PHP
body: <p>I'm a WordPress theme developer and on a theme I'm working on, I've turned on debug mode and get this error inside a select drop-down box for the theme's options page. </p>
  
  <p>The error says this: "Trying to get properties on a non-object." Here is the offending code: </p>
  
  <pre><code> &lt;select name="&lt;?php echo $value['id']; ?&gt;" id="&lt;?php echo $value['id']; ?&gt;"&gt;
                  &lt;?php foreach ($value['options'] as $option) { ?&gt;
                 &lt;option value="&lt;?php echo $option-&gt;term_id; ?&gt;"  &lt;?php if ( $settings[$id] == $option-&gt;term_id) { echo 'selected="selected"'; }?&gt;&gt;
                      &lt;?php echo $option-&gt;name; ?&gt;
                  &lt;/option&gt;                       
                 &lt;?php }?&gt;  &lt;/select&gt; 
  </code></pre>
  
  <p>I can't figure out what I'm doing wrong. The line that's specifically causing the error is this:        </p>
  
  <pre><code>&lt;option value="&lt;?php echo $option-&gt;term_id; ?&gt;"  &lt;?php if ( $settings[$id] == $option-&gt;term_id) { echo 'selected="selected"'; }?&gt;&gt;
  </code></pre>
  
  <p>Thanks for any advice! :)</p>