[eluser]intractve[/eluser]
Hi,
Correct me if I am reading you wrong,
you wish to collect x number of email addresses from your vistors and insert them into the database each as a separate row,
Database Schema is table name:emails (id, guest)
you have already got the view part right, except you do not need to number your array in the HTML
Code:
<input type='text' name='email[]' />
<input type='text' name='email[]' />
<input type='text' name='email[]' />
<in......
That will still work (since its undetermined its best to not number it, just a tip)
Model (model_email.php)
Code:
class Model_email extends Model
{
function Model_email()
{
parent::Model();
}
function insert_email($email)
{
$this->db->set('guest',$email);
$this->db->insert('emails');
}
}
In your controller
Code:
$this->load->model('model_email');
$emails = $this->input->post('email');
foreach($emails as $email)
{
$this->model_email->insert_email($email);
}
I am not validating the emails you should do that too. and enabling Global XSS in config.php is a good idea too(if you have a lot of form interaction on your site).