Welcome Guest, Not a member yet? Register   Sign In
Store data data from multiple fields
#1

[eluser]Lykos22[/eluser]
I'd like some help please. I have a form in my view where I save (add/edit) values to some features that belong to a specific product. Both features and values are fetched dynamicly, so this is how it looks like:
Code:
<?php echo form_open(); ?>
<?php echo form_hidden('product_id', $product->product_id); ?>
<table class="table">
&lt;?php if(count($features) > 0): foreach($features as $feature): ?&gt;
<tr>
  <td>&lt;?php echo $feature->feature_id . form_hidden('feature_id[]', $feature->feature_id); ?&gt;</td>
  <td>&lt;?php echo form_input('value[]', set_value('value[]', $feature->value)); ?&gt;</td>
</tr>
&lt;?php endforeach; else: ?&gt;
// no features and values yet
So if I dump the $this->input->post() of the form I get the results below as expected:
Code:
Array
(
    [product_id] => 1
    [feature_id] => Array
        (
            [0] => 12
            [1] => 10
            [2] => 8
            [3] => 4
            [4] => 9
            [5] => 11
            [6] => 3
            [7] => 14
            [8] => 13
            [9] => 1
            [10] => 2
        )

    [value] => Array
        (
            [0] => value1
            [1] => value2
            [2] => value3
            [3] => value4
            [4] =>
            [5] =>
            [6] =>
            [7] =>
            [8] =>
            [9] =>
            [10] =>
        )
My question is how can I store these results in my database?? note: I'm using a MY_Model in my application


Messages In This Thread
Store data data from multiple fields - by El Forum - 10-10-2013, 04:47 AM
Store data data from multiple fields - by El Forum - 10-10-2013, 09:17 AM
Store data data from multiple fields - by El Forum - 10-11-2013, 02:27 AM
Store data data from multiple fields - by El Forum - 10-12-2013, 02:00 AM
Store data data from multiple fields - by El Forum - 10-12-2013, 03:05 AM
Store data data from multiple fields - by El Forum - 10-12-2013, 03:31 AM
Store data data from multiple fields - by El Forum - 10-12-2013, 04:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB