Hi Christophe,
And what is the problem?
Bob
Hello Bob,
Just I would retreive the variable [title] from the array. I try
$data=>Data3['title']
$Data=>Data3->title
$raw->
...etc
I know ;-)
regards
chris
ps : could you delete my email from the first post, please ?
Hi Christophe,
The simplest way is to leave the Model ID empty in the DB Read action - it doesn't look as though you need it.
Otherwise put {Data3.title} in the Email template assuming that is where you want it.
Bob
So I need the email of the partner to send him the booking. How can I do to use the field from the mysql request, please?
Regards
Hi Chris,
I assume that this is a ChronoForms question? (It's in the ChronoConnectivity forum.)
What field from the DB Read - the only data you are reading so far is a title?
Bob
Yes it's chronoconnectivity, sorry for the mystaken category, could you change it?
and I added the email field in the request..
... and it's a bit more complex because the field is a K2 extra_fields 😉
Hi Christophe,
Errrrrr is this ChronoForms or ChronoConnectivity?
What email field do you have in what request and where does K2 come into it??
That is to say, I have no idea what your question is :-(
Bob
lol
it's chronoform,
a booking form for partner's offers. each offers are in K2 items, one offer by item
The form is call with loadmodule in each k2 item. I pass the k2 id of the item. the k2 item has some extra_fields like price, description, date from to and an email
this partner's email is use to send the booking
Is it more clear ?
Hi Christophe,
If you have the K2 item-id then you can use a DB Read action to get the information from the K2 tables (or a Custom Code action with a MySQL query included if it is a complex query to more than one table).
Bob
hello bob,
this is what i do, a DB read action, and now, i would want, use the result in php to parse the field and use it.
my issue is what can i do to get the value ?
thanks
Hi Christophe,
The results of the DB Read are added to the $form->data array. If you set a Model ID they will be in a sub-array with the same name.
You can use them like any other CF (or PHP) variable.
To see exactly what is there add a Debugger action to the event after the DB Read action - you can delete or disable it when you are finished developing.
Bob
Hello bob,
I find the data and i try this in a custom code Action :
<?php
$m = json_decode($form->data['Data3']['extra_fields']);
foreach($m as $e){
if($e["id"] == "18"){
$v = $e["value"];
define('E_PART' , $v) ;
}
}
?>
Fatal error: Cannot use object of type stdClass as array in /home/golfrendor/www/administrator/components/com_chronoforms5/chronoforms/actions/custom_code/custom_code.php(20) : eval()'d code on line 7
do you have an idea ?
I solved the error by $m = json_decode($form->data['Data3']['extra_fields'], true);
Bob,
Now i can retreive the email of the partner. It's in a define field define('E_PART', 'the_email');
and i would want to put it in the email to field of my send mail action.
do you have an idea to do this, please ?
regards
Hi Christophe,
You need to have it in the $form->data[''] array to use in the Email - I assume that is where you are getting it from to set the define statement?
If you have $form->data['the_email'] then you can use the_email in the Dynamic To box of the Email action.
Bob
Nice, i forced $form->data['the_email'] in the stack and the life is beautifull
thanks bob