Açılır kutusunu php smarty aşağı bir damla bağlıdır

0 Cevap php

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.

İşte kod

      <tr><td align="right" valign="top" style="text-align:right"><strong>Company:</strong></td>
      <td align="left" valign="top" >`<select name= "proj" onChange="top.location =' {$smarty.server.PHP_SELF}'" ><option value='null'>all</option>`
 {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}
    </select>

 </td></tr>`

    <tr>
  <td align="right" valign="top" style="text-align:right"><strong>Project:</strong></td>
  <td align="left" valign="top" > 
   <select name= "comp"  >
  <option value='null'>all</option> 

 {if $p.pname != "" && $p.pname !="null"}

  {foreach from=$companyname item=p}

    {html_options values=$p.pname output=$p.name}
  {/foreach}{/if}
</select>
 </td></tr>

Its not properly formatted,but hope one can understand it. Thanks for help.

0 Cevap