[eluser]Ivar89[/eluser]
I can't seem to insert my Date in the database.
Model:
Code:
function Insert_Publish($data)
{
$ID_Page = $_POST['ID_Page'];
if(isset($data['Publish_date']))
$this->db->set('Publish_date',$data['Publish_date']);
$this->db->where('ID_Page',$ID_Page);
$query = $this->db->update('tblpage');
return $ID_Page;
}
Controller:
Code:
function check()
{
$id['ID_Page'] = $this->insert_model->Insert_Publish($_POST);
$this->load->view('page/check', $id, FALSE);
}
view:
Code:
<?php echo form_open ('page/check') ?>
<p id="Publish"><input type="radio">Publish</p>
<?php
$this->load->helper('date');
$datestring = "%Y-%m-%d";
$time = time();
?>
<p id="Pdate" style="display:none;">Publication Date:</p>
<p><input style="display:none;" type="text" class="date" name="Publish_date" value="<?php echo mdate($datestring, $time);?>" id="Date"></p>
<input type="hidden" name="ID_Page" value="<?php echo $ID_Page ?>" />
<input type="image" src="/public/img/button.jpg" class="btn" value="next" />
</form>
I use the exact same code for a different page and it DOES work there...
All names are checked on capitalt and spelling.
He just does NOT insert it in the database...
btw: it is updating because I multiple steps for making one row in the database.