Jump to content

select <option> value at run time


fareedreg

Recommended Posts

I am filling up option with the help of AJAX and php.. No is there any way possible i can select its value at runtime;.. I mean to say that suppose i have supp id 101,102,103 and so on ... user select one of them by himself.... but can i change their values at run time.

 

 

<select name="cmbsuppid" id="cmbissueid" onchange="showSupplier(this.value)";>

   

    <?php

 

    include('connect.php');

 

    $Tb = "booksupp_master";

 

    mysql_select_db($Db, $link);

                           

    $query = "select supp_id from $Tb order by supp_id";

 

    $result= mysql_query($query,$link);

 

    $fel=mysql_num_fields($result);

    $nro=mysql_num_rows($result);

 

    if ($nro>0)

 

    {

   

               

    while ($row=mysql_fetch_array($result))

 

        {

   

            echo "<option value='$row[supp_id]'>$row[supp_id]</option>\n";

           

                       

        }                       

                             

    }

 

    mysql_close($link);

   

 

 

  ?>

       

    </select>  </tr>

Link to comment
https://forums.phpfreaks.com/topic/188443-select-value-at-run-time/
Share on other sites

yes thanks your right .. thats what i need... but suppose i select 102 value its adding one more 102 in list.. i mean doubling of value is visible.

I am using

 

echo "<option selected value=$fsuppid>$fsuppid</option>";

 

 

If you are talking about selecting a default item use selected="selected" in the option you want selected..

Im not really sure what you mean by "can i change their values at run time."

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.