Welcome Guest, Not a member yet? Register   Sign In
Does CodeIgniter convert all post variables to get variables?
#1

I created two post variables and can only find them in the get array. This doesn't make any sense to me. Does CodeIgnitor do this on it's own?
Reply
#2

I don't think CI would move POST vars to GET. Maybe snippet of code you are using would help troubleshoot it.
Reply
#3

No, Codeigniter does no such thing.

You can verify within debug tools like Firebug if those variables where send as a POST request or as a GET request. It they truely are POST variables then some server issue is at hand. But perhaps you made a small mistake in your html form:

Code:
<form method="GET">
...
</form>
Reply
#4

(This post was last modified: 02-10-2016, 12:58 PM by cupboy.)

(02-09-2016, 05:08 PM)siburny Wrote: I don't think CI would move POST vars to GET. Maybe snippet of code you are using would help troubleshoot it.

Here is some of the code:

javascript code in page:

string1 = '<input type="hidden" name="searchDateStart" value=' + dblquote + searchBegin + dblquote + ' />';
$('#frmMain').append(string1);
 document.forms[0].action = link;
 document.forms[0].submit();  
 
 web address after the form is submitted:
 
//xxx.com/xxx/xxx/date?searchDateStart=2016-02-24&searchDateEnd=2016-02-29

note; had to remove the http to prevent the forum from changing the above to a link

and here is some code from the model:
     $allPost = $this->input->post();
     $allGet = $this->input->get();

$allPost was 0, $allGet was 2
Reply
#5

Hi,

Can you post your html for the frmMain, I am guessing you are using method="get" if you are still getting values in the get array.

Paul.
Reply
#6

(02-10-2016, 12:55 PM)PaulD Wrote: Hi,

Can you post your html for the frmMain, I am guessing you are using method="get" if you are still getting values in the get array.

Paul.

<form id = 'frmMain'></form>
Reply
#7

By default HTML is to use GET method for 'posting' a form, you should set it manually to POST:

<form id='frmMain' method="POST"></form>
Reply
#8

so this fixes it then:
<form id = 'frmMain' method='post'></form>

based on my limited testing... thanks for the clue Paul
Reply




Theme © iAndrew 2016 - Forum software by © MyBB