title: Drop down box depend on another drop down in php smarty
body: <p>I have one drop down box,which represents company name.I want another drop down box depending on company selected,which represent project for that particular company.
  Can any 1 help me out.</p>
  
  <p>Here's the code</p>
  
  <pre><code>      &lt;tr&gt;&lt;td align="right" valign="top" style="text-align:right"&gt;&lt;strong&gt;Company:&lt;/strong&gt;&lt;/td&gt;
        &lt;td align="left" valign="top" &gt;`&lt;select name= "proj" onChange="top.location =' {$smarty.server.PHP_SELF}'" &gt;&lt;option value='null'&gt;all&lt;/option&gt;`
   {assign var='cid' value='0'}
  
  
      {foreach from=$companyname item=p}
  
  
  
      {if  $p.cid != $cid}
         {assign var='cid' value=$p.cid}
          {html_options values=$p.cid output=$p.pname selected=$p.pname}{/if}
        {/foreach}
      &lt;/select&gt;
  
   &lt;/td&gt;&lt;/tr&gt;`
  
      &lt;tr&gt;
    &lt;td align="right" valign="top" style="text-align:right"&gt;&lt;strong&gt;Project:&lt;/strong&gt;&lt;/td&gt;
    &lt;td align="left" valign="top" &gt; 
     &lt;select name= "comp"  &gt;
    &lt;option value='null'&gt;all&lt;/option&gt; 
  
   {if $p.pname != "" &amp;&amp; $p.pname !="null"}
  
    {foreach from=$companyname item=p}
  
      {html_options values=$p.pname output=$p.name}
    {/foreach}{/if}
  &lt;/select&gt;
   &lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>Its not properly formatted,but hope one can understand it.
  Thanks for help.</p>