user7306068
user7306068

Reputation:

post not send form data

I have a problem with sending posts in codeigniter, reading other posts I set the variable max_input_vars = 1000. but does not send the data. the resulting in html is:

<form id="0" action="CO_controller" method="post">
<input id="idric_0" value="0.02508800 154401490122">
<input id="name_0" value="val0">
<input id="per_0" value="10">
<input id="unit_0" value="g">
<input id="ric_0" value="0.02508800 1544014901">
<input id="command0">
<input id="mod0" type="submit" value="Modific" onclick="document.getElementById('command0').value = 'modific';">
<input id="eli0" type="submit" value="Deleta" onclick="document.getElementById('command0').value = 'deleta';">
<input id="id_sal0" value="0.02508800 1544014901">
</form> 
<form id="1" action="CO_controller" method="post">
<input id="idric_1" value="0.02508800 154401490122">
<input id="name_1" value="val0">
<input id="per_1" value="10">
<input id="unit_1" value="g">
<input id="ric_1" value="0.02508800 1544014901">
<input id="command1">
<input id="mod1" type="submit" value="Modific" onclick="document.getElementById('command1').value = 'modific';">
<input id="eli1" type="submit" value="Deleta" onclick="document.getElementById('command1').value = 'deleta';">
<input id="id_sal1" value="0.02508800 1544014901">
</form>

the operation is correct ie when I click the button, set the value of the command and submit. in debug, I go to see the variable $ _POST and it is empty

Upvotes: 0

Views: 56

Answers (2)

Javier Larroulet
Javier Larroulet

Reputation: 3237

Unless you have a route defined so that CO_controller points to a method (and not just a controller) this is not going to work:

<form id="0" action="CO_controller" method="post">

Your form action should point directly to the method within the CO_controller controller which will process the form input.

Assuming the method within the controller is called process_form your form should point to:

<form id="0" action="CO_controller/process_form" method="post">

give it a go and let us know how it works

Upvotes: 0

Danielcraig
Danielcraig

Reputation: 121

As said in the comment, you should use name instead of id. By using id you are not passing the values correctly.

Upvotes: 1

Related Questions