Welcome Guest, Not a member yet? Register   Sign In
Basic 'Update Entry' Script help...

simply create an extraction db call like below

function edit_post()
$edit_post = $this->db->getwhere('guestbook', array('id' => $this->uri->segment(4)), '', '');
return $edit_post

the 4th uri segment should be the post ID number. however use this however you need it. if you use segment 3 than do that. Smile

$data['edit_post'] = $this->your_model->edit_post();

than do a foreach loop over the html <form>. and echo the results inside the value of the text box or textarea.

for example

<?php foreach($edit_post->result() as $edit): ?>
<form action="your_form_action" method="post" enctype="multipart/form-data">
&lt;input type="text" class="field" name="somefield" value="&lt;?=$edit-&gt;somefield?&gt;" /><br />
&lt;?php endforeach;?&gt;

I noticed your using the ci form feature, but its not different just echo your field into the value="";

For update
function update_post()
    $this->db->where('id', $_POST['id']);
    $this->db->update('guestbook', $this->db->escape($_POST));

Messages In This Thread
Basic 'Update Entry' Script help... - by El Forum - 04-28-2010, 02:13 AM
Basic 'Update Entry' Script help... - by El Forum - 04-28-2010, 02:23 AM

Theme © iAndrew 2016 - Forum software by © MyBB