如何在多个文本框中显示所选项目

时间:2014-09-30 07:30:58

标签: php

<td > 
<select data-placeholder="---Choose Stone Color---" style="width:250px;" name="stn_color[]" id="stn_color" class="chzn-select" multiple tabindex="11" readonly disabled="disabled">      
  <?php
    $r1 = '';
    $SLCT_st = "SELECT * FROM master_stone WHERE statu_s='active'";
    //echo $SLCT;
    $QURY_st = mysql_query($SLCT_st);

    while($FTCH_st = mysql_fetch_object($QURY_st))
    {

        $r1.= $FTCH_st->master_stone_id.",";
        //$stone_name=$FTCH_st->master_stone_name;
    }

    $r2 = rtrim($r1,",");
    $SLCT_stn = "SELECT * FROM master_stone WHERE master_stone_id ='$master_stone_id'";
    $QURY_stn = mysql_query($SLCT_stn);
    $FTCH_stn = mysql_fetch_object($QURY_stn);
    $v1 = explode(",",$r2);
    $v2 = explode(",",$FTCH_stn->master_stone_id) ;
    foreach($v2 as $test1)
    {
         $SLCT_stn1 = "SELECT * FROM master_stone WHERE master_stone_id ='$test1'";
        //echo $SLCT_stn1."<br >";
         $QURY_stn1 = mysql_query($SLCT_stn1);
         $FTCH_stn1 = mysql_fetch_object($QURY_stn1);
         echo "<option ".(in_array($test1, $v1)?"selected":"")." value='$test1'>$FTCH_stn1->master_stone_name</option>";
    }
    ?>

强文

这里我从table中获取multiselect值。如果我从multiselect下拉列表中选择了4个值,可以在table中成功插入。但是如果我从该列中获取值意味着它只显示一个值。如何显示所有值。

0 个答案:

没有答案