views:

46

answers:

2

I can't work this out. One minute it was working fine and now it's not and I can't see what's changed!! My problem is simply submitting a username and password for a login function. The form method is set to "post" but for some reason no data is getting through. If I dump $_REQUEST or $_POST they return empty. I know the form is submitting because if I change the method to "get" I receive the data as expected. Can anyone think of any reason why "get" would work when "post" isn't?!?!? If it's relevant, I'm using the codeigniter framework.

A: 

I seem to remember that codeignitor prevents direct access to $_POST - check the docs (some thing like $this->input->post or similar)

Pete
No, $_POST is just fine. CI only unsets $_GET (just checked with one of my CI instances). However, @musoNic80: does $this->input->post() deliver something? Does a var_dump in the index.php show the same problem?
Boldewyn
@Boldewyn: $this->input->post() returns false which according to the CI docs means that the variable does not exist. I've got the global profiler on which shows the $_POST array as empty.
musoNic80
Can you show us the form HTML source?
Pete
A: 

I would check first whether this hasn't got any CI specific reasons as @Pete points out.

The only other idea that comes to mind is that maybe you have a .htaccess file with mod_rewrite directives somewhere, and that a header redirect is done for some reason rather than an internal one. A header redirect would pass along GET variables (if using [QSA]) but lose POST ones.

Pekka
I can't understand why a header redirect would suddenly be happening. I haven't added an .htaccess file, so it wouldn't explain why it's only just stopped working. I'll check it out though.
musoNic80
There was a redirect going on, but buried deep somewhere in the code and not in a .htaccess file. Took quite a lot of debugging to find it.... :-)
musoNic80