Problem with redirect code

Ron 15 Sep, 2016
Hello

I have been using chronoforms V5. After update I have run into some problem. In one of my forms I have a custom code that uses this script : It now does not redirect as per case but just goes to the default URL.. I am not able to find where am I going wrong. Could I get some help ?


    <?php
	
    $country = JRequest::getString( 'country', '', 'post' );
	
    switch($country)
    {

    case 'Afghanistan':
    $url = 'sorry_intro';
    break;

   case 'Akrotiri':
    $url = 'okay_intro';
    break;
	
   case 'Albania':
    $url = 'okay_intro';
    break;
	
   case 'Algeria':
    $url = 'on_new_intro';
    break;
	
   case 'American Samoa':
    $url = 'okay_intro';
    break;
	
   case 'Andorra':
    $url = 'sorry_intro';
    break;
	
	

       default:
          $url = 'intl_details';
    }

   $url = JURI::base().'index.php?option='.$url;
    $doc =& JFactory::getDocument();
    $custom_tag = "<meta http-equiv='refresh' content='5;url={$url}'>";
    $doc->addCustomTag( $custom_tag );
	
    ?>


Thanks

Ron
GreyHead 15 Sep, 2016
Hi Ron,

Max hijacked $doc and used it in CFv5 - please try changing the last part of your code like this
$url = JURI::base().'index.php?option='.$url;
$jdoc = \JFactory::getDocument();
$custom_tag = "<meta http-equiv='refresh' content='5;url={$url}'>";
$jdoc->addCustomTag( $custom_tag );
?>

Bob
Ron 15 Sep, 2016
Thanks Bob..

But I get a Syntax error on this link

$jdoc = /JFactory::getDocument();
GreyHead 15 Sep, 2016
Hi Ronn,

Sorry that should be a \

Bob
Ron 15 Sep, 2016
Thanks Bob,

I tried it no syntax error but as usual it just redirects to the default..

Please help

Ron
Ron 15 Sep, 2016
Thanks Bob.

I had made an error. It worked

Thanks lot

Ron
GreyHead 15 Sep, 2016
Hi Ron,

I suggest that you set a longer time delay and then look at the page HTML to see what meta tag is being added exactly.

Bob
This topic is locked and no more replies can be posted.