0

How can i select the respective value in a drop-down list from html according to name and id received? i need it to edit this information from the data base

i'm trying with this code but don't show me the correct option that i want to send to the drop-down list

<select class="form-control" id="status" name="status" >
    <option value="true" >Available</option> 
    <option value="false" >Not available</option> 
</select>
Reiko
  • 23
  • 3
  • When you say 'select' the value, how exactly do you want to select it? With PHP? .NET? Python? JavaScript? HTML has no ability to 'select' per se; it just displays content from the DOM. Considering you're using a database, regardless of the language, you need to put it in a `
    ` and `POST` the content to a back-end script. Alternatively, you need to extract the value in JavaScript and post the content to the back-end with AJAX.
    – Obsidian Age Jun 26 '17 at 22:37

1 Answers1

0

You need JavaScript for that. I don't think you can do it using html. Update your question if you intend on using JS.

How to select a value in dropdown javascript?

or like this

document.getElementById('status').value = 'true';​​​​​​​​​​
Etherealm
  • 2,234
  • 3
  • 18
  • 34