Reputation: 370
Input values
<input type="hidden" name="service_row[1]['row']" value="1" />
<input type="checkbox" name="service_row[1]['check']" />
<input type="text" name="service_row[1]['observation']" />
<input type="text" name="service_row[1]['parts']" />
Handler code
foreach ($_POST['service_row'] as $data) {
$row_num = $data['row'];
if (isset($data['check'])) {
$checked = 1;
} else {
$checked = 0;
}
$observation = database::escape($data['observation']);
$parts = database::escape($data['parts']);
}
My var dump on $data displays
array
''row'' => string '1' (length=1)
''observation'' => string 'Test' (length=4)
''parts'' => string 'Test' (length=4)
So from what I can see is that the $data array exists and displays the values I have put in but for some reason when I try to put the data into a variable it returns null.
Can anyone see what I am not seeing here? Any help is much appreciated, this one got me stumped right now.
Upvotes: 1
Views: 265
Reputation: 1322
I think that you must use index 'row'
instead of row
or remove quotes from your html.
Upvotes: 3