MySql database is not updating with the new data entered in view. With following the MVC architecture.
My Controller :
public function saveEdit() {
$this->load->helper('form');
$id = $this->uri->segment(3);
$save=array(
'userstory' => $this->input->post('userstoryarea'),
'datetocomplete' => $this-> input->post('datecomplete'),
'name'=> $this->input->post('developer')
);
$this->load_userStory->saveEdited($id,$save);
$this->viewUStory();
}
My Model
public function saveEdited($id,$save){
$this->db->where('devid', $id);
$this->db->update('developer', $save);
}
In some of the places i have called some javascript methods which will return some values to display.
My View
<?php foreach ($story as $UserStory): ?>
<form method="post" action="<?php echo base_url() ."addstories/saveEdit"?>" >
<p> Select Devoloper to add :
<select class="form-control" id="developer" name ="developer" style="width:200px;"> </p>
<?php
$val2 = $row['name'];
foreach($developers as $row)
{
echo '<option value="'.$row->full_name.'" >'.$row->full_name.'</option>';
}
?>
</select>
<p>
<p>
Select a date to complete the project : <i>
<input type="date" id="datecomplete" name ="datecomplete" value="<?php echo $UserStory->datetocomplete;?>" onchange="calculate()">
</i> </p>
<p>
<input type="textarea" name="userStory" id="userStory" value=" <?php echo $UserStory->userstory; ?> ">
</p>
<input type="submit" name ="dsubmit" value="Save" id="submit">
</form>
<?php endforeach; ?>