Re: drop down menu to a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>  How do you specify the value of the option?
>

Or if you are working with values from a database you could do something
simple like:

<SELECT name="name">
   <?php
$q_name = "SELECT * from name_table";
   $r_name = ifx_query($q_name, $connect_id) or die("couldn't execute the
query");
     while ($rec_name = ifx_fetch_row($r_name)) $name[] = $rec_name;

     echo "<OPTION value=\"\">--SELECT--</OPTION>\n";
     foreach ($name as $n)
     {
       if ($n['full_name'] == $_POST['name'])
          echo "<OPTION value=\"{$n['full_name']}\"
SELECTED>{$n['full_name']}</OPTION>\n";
       else
          echo "<OPTION
value=\"{$n['full_name']}\">{$n['full_name']}</OPTION>\n";
     }
     ?>
   </SELECT>

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux