CodeIgniter Forums
How to properly handle a function that needs a variable? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to properly handle a function that needs a variable? (/showthread.php?tid=6076)



How to properly handle a function that needs a variable? - El Forum - 02-13-2008

[eluser]Chris.Campbell[/eluser]
If I have a function that expects a variable from the URL, how to I properly redirect if the user modifies the URL so the variable does not exist? I cannot figure out how to use the redirect function.


How to properly handle a function that needs a variable? - El Forum - 02-13-2008

[eluser]BrandonDurham[/eluser]
Code:
function functionName($var=NULL)
{
    if (!$var) ...
}



How to properly handle a function that needs a variable? - El Forum - 02-13-2008

[eluser]Chris.Campbell[/eluser]
Solved. Make sure you load the URL helper Tongue