-1

次のコードがあります。

echo "<td><textarea wrap='soft' class=tarea3  name='inston[]'>".$r['inston']."</textarea></td>\n";

instonその変数を使用して、ドロップダウン リストに関連付けたいと思います。ドロップダウンリストの作業コードがあります:

  <tr><td class="tdt">

  <?php te('Hosting Server');?>:</td> <td title='Select server'>
   <select validate='required:true' class='mandatory' name='manufacturerid'>
   <option value=''>Select</option>
  <?php 
    foreach ($agents5 as $a) {
      $dbid=$a['id'];
      $atype=$a['label']; $s="";
      if (isset($manufacturerid) && $manufacturerid==$a['id']) $s=" SELECTED ";
      echo "<option $s value='$dbid' title='$dbid'>$atype</option>\n";
    }
    echo "</select>\n";
  ?>


  </td></tr>

上記のドロップダウン スクリプトの SQL クエリ、

$sql="SELECT * FROM items where itemtypeid=32 OR itemtypeid=44 order by label";
$sth=db_execute($dbh,$sql);
while ($r=$sth->fetch(PDO::FETCH_ASSOC)) $agents5[$r['id']]=$r;

inston上記のコードを使用して変数を関連付けるにはどうすればよいでしょうか?

4

1 に答える 1

1

あなたの質問は明確ではありません。私が理解したことから、答えはこれだと思います

まず idselectタグにを使用し、次のような関数textareaを使用します。onChange

<textarea wrap='soft' class=tarea3  name='inston[]' id='inston'>".$r['inston']."</textarea>
<select validate='required:true' class='mandatory' name='manufacturerid' id='manufacturerid' onChange='setInston()'>

そして、このJavaScript関数を使用します:

function setInston() {
  var x = document.getElementById("manufacturerid").value;
  document.getElementById("inston").innerHTML= x+"&#10;";
}
于 2013-10-15T15:02:47.930 に答える