I'm trying to pass a variable from a js function to php form (in the same file). Here is my form :
<div id="hoursDetails" class="toogle_form" style="display:none">
<table border=0>
<?php
for ($i=0 ; $i<$N; $i++){ //$N is the variable I want to retrieve
echo '<tr>
<td><div id="date'.$i.'" ></div></td>
<td>
<input type=text name="action'.$i.'" placeholder="Votre action"/>
<input type="text" name="temps'.$i.'" placeholder="nombre heures"/>
</td>
</tr> ';}
?>
</table>
</div>
I tried to create a hidden input in the form :
<input type="hidden" id="variable" name="variable" value="" >
And to set the value from the js function using $('#variable').val(10)
for example, but still don't know how to retrieve this variable when looping.
I can retrieve this variable from the controller, but is it possible to pass it from controller to the view without using index() function? (I'm using CodeIgniter
Could anyone help me please ? Thanks
name="action[]"
Then you would just need to loop over$_REQUEST["action"]
into your php to get all of the values. – Florian F. Oct 11 '12 at 15:55