[eluser]vincej[/eluser]
HI - The POST array which is uploading from my View looks like this:
Code:
Array
(
[2] => 31 Dec 1969
[3] => 31 Dec 1969
[1] => 31 Dec 1969
[4] => 31 Dec 1969
[7] => 31 Dec 1969
[5] => 31 Dec 1969
[8] => 31 Dec 1969
[6] => 31 Dec 1969
[submit] => Save Changes
)
Model:
Code:
function Updatelocation(){
foreach ($_POST as $key=>$value )
{
$date = strtotime($value);
$this->db->where('puid', $key);
$this->db->update('pudates',$date);
}
View
Code:
<tr align="center">
<td width="100" align="center"><?php echo $item['locationid'];?></td>
<td width="100" align="center"><?php //$data = array('name'=>'location[]', 'size'=>20,'value' => $item['location']); echo form_input($data); ?></td>
<td width="100"><?php $data = array('name'=> $theIDs[0],'size'=>15,'value' =>(strftime("%d %b %Y",$theDates[0]))); echo form_input($data);?></td>
<td width="100"><?php $data = array('name'=> $theIDs[1],'size'=>15,'value' =>(strftime("%d %b %Y",$theDates[1]))); echo form_input($data);?></td>
<td width="100"><?php $data = array('name'=> $theIDs[2],'size'=>15,'value' => (strftime("%d %b %Y",$theDates[2]))); echo form_input($data); ?></td>
<td width="100"><?php $data = array('name'=> $theIDs[3],'size'=>15,'value' => (strftime("%d %b %Y",$theDates[3]))); echo form_input($data);?></td>
<td width="150"> <?php echo anchor('admin/pickup_detail/deletelocation/'. $item['location'], 'Delete');?></td>
</tr>
MY Model is broken. First my dates need to be converted into Unix time, then they have to update the DB.
Edit: The strtotime() is working but for some reason I can not get my data uploaded.
My syntax is clearly wrong - But I can't see where.
MANY MANY THanks for any help you might be able to give !