Tricky question and I don’t even know if it is possible.
A dbase table contains field names: “numberofpersons” having values like “4 persons, € 114,00 per night”. Another field named “totalpersons” gives, in this case, the number 4.
I have a form that contains a select for the number of persons that will occupy a home. The dropdown will show something like “4 persons, € 114,00 per night”. The value for that specific field will contain the price “114,00” for calculation purposes.
Below that I have an input field (that will be hidden later). I want that to show the equivalent of “totalpersons” as selected in “number of persons”. I hope this makes any sense
Sorry I don’t have some to actually implement and test this but I would be looking to do this in the following way.
I think you are going to need an additional data query here
Assuming your initial query populates the select element
You are going to have to fire a second query via the onchange event of the select to re-query the database table via a $_GET parameter
So your main query would get the elements for the select item
A second query, set to “No Auto Load” would them be needed to re-query the database table and filter it on the currently selected key value of the select element, fired by the onchange() event.
So your occupancy form field would be populated by the second linked query, not the select query
Hope you understand, quite difficult to explain without the actual code
I thought I understood, but apparently not. It looks like “dependant dropdown”, but can’t get it to work yet. Thanks anyway