Dropdown from database with conditions
-
Hello
Thank’s for your work on this plugin.
It’s very complete and… complex ??I have a project to make a distance calculator (for CO2 compensation) with some functions :
Field 1 : Start city (dropdown)
Field 2 : End city (dropdown rely on Field 1)
Field 3 : Get distance in database and display (read only)
Field 4 : nbr of passengers on this travel (classic dropdown)
Field 5 : Field 3 * Field 4 (calculated field)I have made this :
1> I have created database DONNEES with 4 columns (FROM, CITY, KMS, CO2)
2> I have filled a dropdown (Field 1) from database with success (mySQL)
3> I have filled a dropdown (Field 2) with this sql query
SELECT CITY FROM DONNEES WHERE FROM=<%fieldname1%>
Problem > a empty lines appears in dropdown Field2
First Question > How display data in dropdown ?
Second question > How get data in KMS and CO2 columns after selection FROM (Field1) and CITY (Field2)My link
https://www.fondationdelille.org/climat/cest-a-vous/calculez-votre-empreinte-carbone/Thanks for your attention
Best regards
Gilles
- The topic ‘Dropdown from database with conditions’ is closed to new replies.