data['my_mark'] = $title;?>​why can I not get the variable value in the my_mark variable in chronoform ?what am I missing ?​thanksreggp"> Passing php variable from joomla to chronoform field - Forums

Forums

Passing php variable from joomla to chronoform field

gianpaolo72 04 May, 2020
Hi,

how can I pass a joomla php variable to chronoform input field ?
I created a variable in joomla $title="home";
and I am calling the form with
{chronoforms6}zip-cnt{/chronoforms6}

in parallel I created in the chronoform a custom code before submitting the form
<?
$this->data['my_mark'] = $title;
?>

why can I not get the variable value in the my_mark variable in chronoform ?
what am I missing ?

thanks
reg
gp
Max_admin 04 May, 2020
Where in Joomla did you create the variable ?

Variables are limited to the scope in which they were defined, you need to set this variable in the $_POST then it will be available in Chronoforms data:
$_POST['my_mark'] = 123;
later in Chronoforms:
echo $this->data["my_mark"]; /// prints 123
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
gianpaolo72 04 May, 2020
ok and if I want to use this variable in a hidden field ?

thanks
regs
gp
gianpaolo72 04 May, 2020
sorry one more question, if I use this form (same form) in a for statement passing each time a different variable
for ($i = 1; $i <= 3; $i++) {
$_POST['my_mark'] = $i;
{chronoforms6}zip-cnt{/chronoforms6}
}
how can I pass this variable to each "form" in a hidden field (question above) and how can "exit" from first form when I is submitted.
I noticed that once the first form is submitted I cannot access to fields of the second and the third form and so I cannot fill them. I get always the success page of first form.

thanks
regs
gp
Max_admin 15 May, 2020
You can pass variables to the form in the plugin call:
{chronoforms6}form-alias&variable=value{/chronoforms6}
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.