Polular select component in html page with data coming from table

Asked

Viewed 36 times

-2

I have a php variable that has its value.

ex: "AREA 05"

This is displayed in the input. I have a table that is related to the logins according to these areas. As I do and if it is possible to use this php variable to popular the html select tag with its respective logins, ie the select be populated according to your area. It is possible?

2 answers

1


I don’t quite understand your question, but if you want to do something dynamic, asynchronous, that when the person is selecting the item in select, you can do a new database search and popular the table, you can use AJAX with PHP take a look at the example in W3SCHOOL if that’s what you’re looking for.

  • table is not popular, but the item select is popular according to the result of the php variable.

  • Exactly, you can use php ajax to as the user selects in select Voce popular another select or anywhere else, generating queries regarding the new variable value, in case you would be using get or post method of your preference to pass the new value to the variable responsible for the query.

  • there is the possibility to show me an example??

  • Read this article in Devmedia will help you with an example.

0

Yes it is possible, you will have to deal with AJAX, when the input field is filled with 'AREA 05', A query will be made via AJAX in the bank with the reference at 'logins', the results will be brought and displayed in the list of 'select'.

If you want, you can use this example to base.

Browser other questions tagged

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