Questions
  • Value dynamically insert into input box on selected

  • Asked by Fareed on 1st Dec 2017

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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
/<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 ;

  • https://api.adorable.io/avatars/40/2477266412.pngUse Ajax to fetch data and insert them into input fields. http://api.jquery.com/jquery.ajax/ – Saran
Add Answer

    Can You Answer this? Help us answer the question!

      • Answer
      Supports basic Markdown syntax.