Very inexperienced with EE 2.4, but im experienced with PHP & HTML. I am attempting to use the following code to get variables from URL & then run an IF/IF ELSE statement:

<?php $firstname=$_GET[“firstname”]; $zipcode=$_GET[“zipcode”]; $option=$_GET[“option”];
  if ($option==”Instant Medigap Prices”) { header(‘Location: 1’); } 
  elseif ($option==”2”) { header(‘Location: location2test’); } 
  elseif ($option==”3”){ header(‘Location: location3test’); } 
  elseif ($option==”4”){ header(“Location: location4test”); }

Obviously the above wont work in EE with php enabled. How can i change it to allow it to work within EE 2.4? I’ve also tried using Mo Variables for aid but still unsure on implementation. i.e. how do i set a var


Help & Clarification much appreciated !!


1 Answer 1


Not positive the following will work on 2.4, but try it:

With a url mysite.com/news/latest?option=abcd and Mo Variables you should be able to get query string variables within an if/else conditional like:

{if "{get:option}" == "abcd"} 
{if:elseif "{get:option}" == "1"}
{if:elseif "{get:option}" == "2"}

and then redirect. Change the TEMPLATE_GROUP/TEMPLATE text to the template group and template you're wanting to route to (i.e.: news/index).

In mo variables "Add GET: {get:your_key}" needs to be enabled in settings (Add-Ons > Extensions > Mo' Variables > Settings).

Also, note ee 2.4 is pretty old at this point and many changes have been made in subsequent 2.x updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.