Welcome Guest, Not a member yet? Register   Sign In
How I got around $_GET restrictions
#1

[eluser]Unknown[/eluser]
I wanted to use get vars but didn't want to make some crappy URL like

index.php?c=bla&m=bla

This is used for search results in my app so I can keep it pretty

http://www.mysite.com/search/?q=someurlencodedstuff

Here is the simple code I put in my model that handles search results

Here is how i did it recently. I'm sure it will piss off some purists, but google search indicates that people really want to be able to use CI with a feature like this... so this is an easy "in place" solution you can use

Code:
<?php
//adapt this code for your own use
                //added example.com to satisfy parse_url
        $url="http://www.example.com".$_SERVER["REQUEST_URI"];
        $url=parse_url($url);
                //I'm expecting variables so if they aren't there send them to the homepage
        if (!array_key_exists('query',$url))
        {

             redirect('/'); exit;
        }
        $query=$url['query'];
        
        parse_str($query,$_GET); //add to $_GET global array
        
        var_dump($_GET);
?>


Messages In This Thread
How I got around $_GET restrictions - by El Forum - 04-04-2011, 10:13 PM
How I got around $_GET restrictions - by El Forum - 04-04-2011, 11:20 PM
How I got around $_GET restrictions - by El Forum - 04-05-2011, 12:04 AM
How I got around $_GET restrictions - by El Forum - 04-05-2011, 08:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB