On a codeigniter installation, I am trying to use the inbuilt $this->input->post('some_data')
function, however $this->input->post()
is an empty array.
A print_r($_POST)
gives all the variables fully and correctly?
According to the codeigniter docs, The input class "is initialized automatically by the system so there is no need to do it manually", leaving me wondering what else I'm meant to do.
Any thoughts on how I should try to get this working?
Thanks!
You can check, if your view looks something like this (correct):
<form method="post" action="/controller/submit/">
vs (doesn't work):
<form method="post" action="/controller/submit">
Second one here is incorrect, because it redirects without carrying over post variables.
Explanation:
When url doesn't have slash in the end, it means that this points to a file.
Now, when web server looks up the file, it sees, that this is really a directory and sends a redirect to the browser with a slash in the end.
Browser makes new query to the new URL with slash, but doesn't post the form contents. That's where the form contents are lost.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With