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