Welcome Guest, Not a member yet? Register   Sign In
Submit td
#1

Dear all,

I am trying to submit some data from a table, in order to insert those to my db. But unfortunately I don't get anything from my table. Here is some code to understand my problem:


View:
Code:
<?php echo form_open('controller/add') ?>
    <table>
        <tr>
            <td><input type="hidden" name="rowValue[]"/>1</td>
            <td>
                <input type="hidden" name="seatValue[]"/>
                <select>
                    <option value="1">1</option>
                    <!--some more values-->
                </select>
            </td>
        </tr>
    </table>
    <button type="submit">Submit</button>
<?php echo form_close ?>

Controller function add:
Code:
public function add() {
    if(isset($_POST)) {
        $row = $_POST['rowValue'][0];
        $seat = $_POST['seatValue'][0];
    }
    $this->add_model->add_r_s($row, $seat);

Model function to insert into db:
Code:
public function add_r_s($row, $seat) {
    $fields = array ($row, $seat)
    $this->db->insert('table_name', $fields);
}
I am using "rowValue[]" in the view, because obviously I have some more <td>-tags in my view.
I don't understand why it doesn't get the submit from the view, because when I try print_r($row); I don't get anything.
What am I missing?

Cheers
Reply


Messages In This Thread
Submit td - by Peek - 02-18-2018, 10:59 AM
RE: Submit td - by salain - 02-18-2018, 11:38 PM
RE: Submit td - by Wouter60 - 02-18-2018, 11:44 PM
RE: Submit td - by InsiteFX - 02-19-2018, 05:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB