[eluser]mjsilva[/eluser]
Here is solution using Jquery:
In View:
Code:
<html>
<head>
<s.c.r.i.p.t. src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></s.c.r.i.p.t.>
<s.c.r.i.p.t type="text/javascript">
$("#more_one_input").click(function(){
var html = "<input type='text' name='my_dynamic_inputs[]' />";
$("#my_dynamic_input_div").append(html);
});
</s.c.r.i.p.t.>
</head>
<body>
<a href="#" id="more_one_input">Add one input</a>
<?=form_open("my_form")?>
<div id="my_dynamic_input_div"></div>
<p><?=form_submit()?></p>
<?=form_close()?>
</body>
</html>
In PHP:
Code:
<?php
class my_form extends Controller {
function index()
{
$my_inputs_array_values = $this->input->post("my_dynamic_inputs");
foreach ($my_inputs_array_values as $key => $value )
{
echo $value;
}
if ($this->form_validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>
Not tested, errors are expected!
Hope it helps