PHP - How to get Field value from a form?

Ask a question


In a form I have a dropdown field result of an application. I have a combo second field whose content will depend on the choices made in the first box.
As not get the value of the initial field (without sending the form to submit server).


Two solutions:
  • 1 - you accept that your page will reload, then you do not use javascript, but in the list you put an:

onChange = Submit (). In <form you put action="your_page_php.php"

In your_page_php you check that $ _POST ['name_list1']!="" set your database and load your second list.

For the selected value of your first list, you have to put in all:
  • 2 - If you do not wish your page to reload when you use Javascript and AJAX is to call another PHP script that will read the database and load the list into two FCT lists.

Do a Google search on "Ajax-related lists ".


Thanks to Alain42 for this tip.

PHP - Change the greetings message on you website
Importing large SQL file via phpMyAdmin