I am using 2 forms, one is redirecting to the other and the variable $region is also set according to a value of a dropdwn selection. I am appending the variable value in the URL by using this code.
On the second form I enquire the variable and use a hidden field
so I can use the variable to my form. After a server side validation occurs, I lose the value of $region. Is there any way I can send the variable back from server side validation or even declare it as global variable somehow?
<?php
$option = JRequest::getString('region', '', 'post');
switch ($option) {
case 'LAM':
default:
$url = 'book-training?region=LAM';
break;
case 'APAC':
$url = 'book-training?region=APAC';
break;
case 'EMEA':
$url = 'training-form?region=EMEA';
break;
case 'NAM':
$url = 'book-training?region=NAM';
break;
}
$url = 'http://mydomain/'.$url;
$mainframe->redirect($url);
?>
On the second form I enquire the variable and use a hidden field
<?php
if ( !$mainframe->isSite()) {return;}
$region = JRequest::getVar('region', '', 'get');
?>
<input type="hidden" name="region" value="<?php echo "$region"; ?>" />
so I can use the variable to my form. After a server side validation occurs, I lose the value of $region. Is there any way I can send the variable back from server side validation or even declare it as global variable somehow?