I am creating a variable from an SQL query inside my form but I don't know how to pass it to the output so I can write to a database table. I would use a hidden input field but it messes up with the layout as I am using rels for showing hidden fields. Is there a different way to pass the variable to the form output?
Joomla 1.5.26
Chronoforms 3.2
Joomla 1.5.26
Chronoforms 3.2
Hi quantum_leap,
You can do the query after the form is submitted - that's the most elegant solution.
I'm surprised that the hidden input causes a problem with the rel attributes, usually you can put it at the beginning or end of the form with no problem. It can even go after the submit button.
Otherwise you can save the value in the Joomla! User Session on load and recover it again on submit.
Bob
You can do the query after the form is submitted - that's the most elegant solution.
I'm surprised that the hidden input causes a problem with the rel attributes, usually you can put it at the beginning or end of the form with no problem. It can even go after the submit button.
Otherwise you can save the value in the Joomla! User Session on load and recover it again on submit.
Bob
Thanks Bob. Would it be an overkill to ask how to save and load the value to and from the Joomla! user session? No way I can do the query after the form is submitted, the query is done to populate a dropdown boxes in the form.
Hi Jelu,
Basic version:
More in this article I just Googled.
Bob
Basic version:
<?php
$session = JFactory::getSession();
$session->set('some_name', 'some_value');
?>
<?php
$session = JFactory::getSession();
$xxx = $session->get('some_name', 'default_value');
. . .
?>
More in this article I just Googled.
Bob
Thank you, Bob!
I have a problem with the Joomla! User Session here, Bob. I have two forms one is redirecting to the other. The first form has a dropdown list of 4 values. On the first form's On Submit code - before sending email: box I have entered
On the second form I am retrieving the value with
The problem lies in the fact that I always get the first value of the if loop which is LAM on the second form. I don't know why, it's a simple loop, it should work!
I've also tried replacing $region with $_POST['region'] with no change in results.
<?php
if ( !$mainframe->isSite() ) { return; }
$session =& JFactory::getSession();
if ($region = "LAM") {
$session->set('region', 'LAM');
} else
if ($region = "APAC") {
$session->set('region', 'APAC');
} else
if ($region = "EMEA") {
$session->set('region', 'EMEA');
} else
if ($region = "NAM") {
$session->set('region', 'NAM');
}
?>
On the second form I am retrieving the value with
<?php
if ( !$mainframe->isSite() ) { return; }
$session =& JFactory::getSession();
$region = $session->get('region');
?>
The problem lies in the fact that I always get the first value of the if loop which is LAM on the second form. I don't know why, it's a simple loop, it should work!
I've also tried replacing $region with $_POST['region'] with no change in results.
Ok this code worked!
<?php
if ( !$mainframe->isSite() ) { return; }
$session =& JFactory::getSession();
if ($_POST['region'] == "LAM") {
$session->set('region', 'LAM');
} else if ($_POST['region'] == "APAC"){
$session->set('region', 'APAC');
} else if ($_POST['region'] == "EMEA"){
$session->set('region', 'EMEA');
} else if ($_POST['region'] == "NAM"){
$session->set('region', 'NAM');
}
?>
This topic is locked and no more replies can be posted.