Questions Value dynamically insert into input box on selected

1454 asked on

Plz Help Me how i get value in input box when i select item code ? and value insert in item name & Price Per pc

/<table>
<tr>
<th>Item Code</th>
<th>Item Name</th>
<th>Quantity</th>
<th>Price Per Pices</th>
<th>Value</th>
</tr>
<tbody>
<tr>

<td>
<select name="itemcode" class="field-long" Id="myDropdown">
   <option selected="selected" value="-1">Select Item Code</option>
  <?php $k=1; $sql="select * from `product` order by id asc";
  $que=mysql_query($sql);
  while($eletronic=mysql_fetch_assoc($que))
  {
  ?>
  <option value="<?php echo $eletronic['itemcode']?>"><?php echo $eletronic['itemcode']?></option>

 <?php
    $k++; 
    }
    ?>
    </select>

</td>
<td><input type="text"  name="Item Name" id="Item Name" autocomplete="off"></td>
<td><input readonly type="text" name="quantity"  id="quantity" autocomplete="off"></td>
<td><input readonly type="text" name="price-per-pc"  id="price-per-pc" autocomplete="off"></td>
<td><input type="text" name="value"  id="value"></td>
</tr>
</tbody>
</table>

table detail

CREATE TABLE IF NOT EXISTS product ( id int(11) NOT NULL auto_increment, itemcode varchar(50) NOT NULL, Item Name varchar(50) NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

  • 1Use Ajax to fetch data and insert them into input fields. http://api.jquery.com/jquery.ajax/
Add Answer
All HTML codes will be stripped in the comment, except inline <code> HTML tag.

Can You Answer this? Help us answer the question!

    • Answer
    Supports basic Markdown syntax. Excluded syntaxes (Headers, Lists, Blockquotes, Table, Images)