Forums

Data Base Read and Display of Data

gpiosenka 18 Dec, 2014
I have what I think is a fairly direct problem but I could not find a solution for it. I am not experienced in HTML or PHP programing. My desired is to create a form consisting of a drop down box where the entries are breeds of dogs. In the drop down box each breed has associated with it an ID_number. For example if the user selects Bulldog the associated value returned is the integer 1. If the user select a Basset hound the associated value returned is 2 and so on. So each bread has a unique ID number which in turn is associated with the ID number in a chronoforms database that I created separately called prices. The data base row (ID number) is associated with the dog breed defined in the drop down box. Each row has four entries which are the prices for four different types of services for that specific dog breed. So the data base structure looks as shown below
ID Price1 Price2 Price 3 Price 4
1 50 60 70 80 this row is associated with the costs for a bulldog
2 40 50 60 70 this row is associated with the costs for a basset hound
.
100 30 40 50 60 this last row is associated with the costs of a Yorkshire Terrier
After the user selects the breed of dog from the drop down list I want to read the four prices associated with the breed (defined by the ID row) and display the price data in four different text boxes.
I know to do that I have to do a data base read from the prices data base, retrieve the four price values and display them but I do not know how to do that.
Any help would be most appreciated.
esl 30 Dec, 2014
I did something similar try this back up file, just restore on your CF5... once you restore go to onLoad event and DB_Read and select your table and scroll to the conditions box on the bottom and change the "id" to your ID then change the field name "breed" to your dropdown fields name that holds the values and it should work... good luck!
gpiosenka 30 Dec, 2014
Thank you for your help. Let me clarify the problem a bit based on what I have learned.

I am using Chronoforms 5 and Chronoconnectivity 5 ,

I have created a form called prices which I used to load a data base of dog breeds and prices for various services.

So the data base looks like

ID Breed Price 1 Price 2

1 boxer $10 $15

2 terrier $ 25 $35

etc

I created another form that will display on the front end which is a drop down box of dog breeds. The user selects a breed from the list. The drop down values are assigned to match the ID number in the data base. as shown below

boxer=1

terrier=2

etc

After the user selects the breed and submits the form I want to use the chronoconnectivity plugin to display the two prices for the selected breed. I can do the selection by putting the code

<?php

return array('price_con.id' =>value);

?>

in the model conditions box on the Models tab in CHronoconnect . Where value is the result of the selection from the drop down list. THe dropdown list field name is breed. I assume that is a "variable" that will have the value of the ID number associated with the breed. That is if the user selected boxer the value of the variable breed would be 1. How do I pass the variable breed to the PHP code above as the term value ?
esl 31 Dec, 2014
send you a PM
This topic is locked and no more replies can be posted.