views:

137

answers:

3

So I'm using codeigniter and I've had very letter experience with it so far but here's my issue.

I have an if statement I've set up that says if (@$_GET['f'] == 'callback') then do something, if not, do something else.

So basically my URL ends up looking like this:

http://localhost/finalproject/myspacedev/index?f=start

and all I get is a 404 page. I've tried turning on get in the config, done a bunch of reading on here about using the uri segment class in CI, but all I get are 404 errors. What am I doing wrong here? It's driving me nuts!

A: 

Nevermind I'm dumb.

It's PATH_INFO, not PATH INFO.

Still having some issues but for now I'm good.

Bobby
A: 

CodeIgniter automatically maps $_GET variables to class member parameters, which is far nicer to work with (see Controllers in the CI docs).

An example:

<?php
class blog extends Controller {

    function archives($filter = '') {
        // $filter is a $_GET paramemter
    }
}
?>

The above controller would be available at /blog/archives/ and anything after that portion of the URI would be passed as the $_GET parameters. If /blog/archives/ returns a 404, then you probably don't have the .htaccess file in the web root, or you may not have it enabled in the Apache configuration.

Bruce Alderson
A: 

It must have something to do with my .htaccess file, even though I thought I had it set up correctly. I tried to do it that way and never had any success so I just ended up enabling GET with the parse_str line that everyone passes around.

In any case, I got it to work even if its not the cleanest, most efficient way.

Bobby