Welcome Guest, Not a member yet? Register   Sign In
problem with posts update/edit
#1

[eluser]Tetek[/eluser]
Hi all
I have a problem with editing posts in my blog. look at this.

controller
Code:
function editnews2()
    {
        
        $_iNews = (int) $this->uri->segment(3);
        $this->db->where('id', $_iNews);
        $data['query'] = $this->db->get('entries');
        $this->load->view('editnews2', $data);

    }
function news_update()
    {
    $this->db->where('id', $this->uri->segment(3));
    $this->db->update('entries', $_POST);
    redirect('blog'.$_POST['id']);
    }

Editnews view
Code:
<html>
<head>
<link rel="stylesheet" href="/css/style.css" type="text/css" />
<?=$this->load->view('header');?>
</head>
<body>

<div id="main">

    &lt;?php foreach($query->result() as $row):?&gt;
    &lt;?=form_open('blog/news_update/'.$this->uri->segment(3));?&gt;

        <p>&lt;input type="text" name="title" value="&lt;?=$row-&gt;title?&gt;" />&lt;/input&gt;</p>
        <p>&lt;textarea&gt;&lt;?=$row->body?&gt;&lt;/textarea&gt;</p>
        <p>&lt;input type="submit" value="Zapisz zmiany" /&gt;</p>
    &lt;/form&gt;

    &lt;?php endforeach;?&gt;
    
</div>
</div>

&lt;/body&gt;
&lt;?=$this->load->view('footer');?&gt;
&lt;/html&gt;

ERROR:
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined index: id

Filename: controllers/blog.php

Line Number: 110
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\system\libraries\Exceptions.php:164)

Filename: helpers/url_helper.php

Line Number: 455

Can u see where is the mistake?


Messages In This Thread
problem with posts update/edit - by El Forum - 01-27-2008, 11:38 AM
problem with posts update/edit - by El Forum - 01-27-2008, 12:07 PM
problem with posts update/edit - by El Forum - 01-27-2008, 12:13 PM
problem with posts update/edit - by El Forum - 01-27-2008, 05:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB