How to update a <select> with data from another <select>

Asked

Viewed 112 times

0

I would like to know how to update a select with data from another.

I currently use SQL, I already have a connection created:

$connection = new COM("ADODB.Connection"); //instancia a classe de conexao
$connection->Open("PROVIDER=SQLOLEDB;Data Source=.;Initial Catalog=ADM;User ID=userxxx; Password=userxxx"); //estabelece conexão com MSSQL 

<select>
  <option value="01">Empresa Construção</option>
  <option value="02">Empresa Prod Beleza</option>
  <option value="03">Empresa agricola</option>
  <option value="04"selected>Empresa comida</option>
</select>

I would like, when selecting one of the companies (for example "Construction Company"), to automatically search my bank for the information in the table and return by filling out the below automatically, with the information relating only to this company.

<select>
  <option value="01">Tintas</option>
  <option value="02">madeira</option>
  <option value="03">Cimento</option>
  <option value="04"selected>Pedra</option>
</select>
  • You will do this with ajax, in the change event of the first select you run ajax take the dice and play in the second select.

  • I’m sorry, I’m new at this and I don’t quite understand, I didn’t get to perform anything with Ajax

  • Read this article: https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX/Getting_Started

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.