I hope someone is willing to help me.
I have build a simple form with two fields. Year and Event ('Jaar' and 'Evenement' in Dutch).
When the Year is selected, a dynamic dropdown populates the Event field. This wors fine.
You can find it here http://bvdp.krah.nl/index.php?option=com_chronoforms5&chronoform=Achmea
After submit I want to display the results from a table that I build in the Joomla db,
I tried Db Read Action (in the 'on submit' event, but I lack the knowledge on how to set that up properly.
I also tried in stead of the DB read a custom code action that displays the result from the table based on the selections made in the form, but the query is not picking up my {year} and {event} in the query:
I use this:
This gives the desired result:
But the one with the variables does not seem to pick it up..
I am not a hero in PHP and searched the forum for hours for a solution but cannot find it.
I am sure it should be relatively easy, but I am running into a brick wall here.
Any suggestions/help are welcome.
I have build a simple form with two fields. Year and Event ('Jaar' and 'Evenement' in Dutch).
When the Year is selected, a dynamic dropdown populates the Event field. This wors fine.
You can find it here http://bvdp.krah.nl/index.php?option=com_chronoforms5&chronoform=Achmea
After submit I want to display the results from a table that I build in the Joomla db,
I tried Db Read Action (in the 'on submit' event, but I lack the knowledge on how to set that up properly.
I also tried in stead of the DB read a custom code action that displays the result from the table based on the selections made in the form, but the query is not picking up my {year} and {event} in the query:
I use this:
$result = mysqli_query($con,"SELECT * FROM bap_zk_achmea_uitslagen WHERE Jaar='{Jaar}' AND Evenement='{Evenement}' ");
This gives the desired result:
$result = mysqli_query($con,"SELECT * FROM bap_zk_achmea_uitslagen WHERE Jaar='2013' AND Evenement='10 KM' ");
But the one with the variables does not seem to pick it up..
I am not a hero in PHP and searched the forum for hours for a solution but cannot find it.
I am sure it should be relatively easy, but I am running into a brick wall here.
Any suggestions/help are welcome.
Hello jkrah,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I save form data to a database table?
How to load record data from a database table into your form
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I save form data to a database table?
How to load record data from a database table into your form
P.S: I'm just an automated service😉
That is the other way round. I know how to save form data to a table and the second option is not what I am looking for
Hi jkrah,
You can't use the curly brackets syntax {Jaar} in PHP, Instead use $form->data['Jaar'] e.g.
To use the DB Read action set the Table to point to your table and add a WHERE clause in the Conditions box like this
Bob
You can't use the curly brackets syntax {Jaar} in PHP, Instead use $form->data['Jaar'] e.g.
" . . .WHERE `Jaar` = '{$form->data['Jaar']}' AND `Evenement` = '{$form->data['Evenement']}'
which uses the different PHP curly brackets.
To use the DB Read action set the Table to point to your table and add a WHERE clause in the Conditions box like this
<?php
return array('Jaar' => $form->data['Jaar'], 'Evenement' => $form->data['Evenement']);
?>
See this FAQ for more examples.
Bob
This topic is locked and no more replies can be posted.