0
Thanks

A few words of thanks would be greatly appreciated.

PHP - How to get Field value from a form?




Issue


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).

Solution


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 ".

Note


Thanks to Alain42 for this tip.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Related

This document, titled « PHP - How to get Field value from a form? », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

0 Comments