I have a form in my code that has some input fields and a select field. The select field is populated by a table in a db, which also contains a clients name and e-mail.
When the select field is changed, it has to put the clients name and e-mail in the correct input fields. I have tried some ways, but haven't found the right one yet.
Here's my code:
<table>
<tr><td>Company</td><td>
<select id="namelist" name="namelist" onchange="updateinput()">
<?php
$result = mysqli_query($con, "SELECT * FROM clients ORDER BY ID");
while($row1 = mysqli_fetch_array($result))
{
$value = $row1['Value'];
$name = $row1['Name'];
echo"<option value='$value'>$name<br>"; } ?>
</select></td></tr>
<tr><td>Name of contact</td><td>
<input required id="namecontact" name="namecontact" type="text" placeholder="Client name"></td></tr>
<tr><td>E-Mail contactpersoon</td><td>
<input required id="email" name="email" type="text" placeholder="E-Mail"></td></tr>
</table>
Much thanks in advance