PHP - How to get Field value from a form?

December 2016


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.

Related :

This document entitled « PHP - How to get Field value from a form? » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.