[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">
<?php foreach($query->result() as $row):?>
<?=form_open('blog/news_update/'.$this->uri->segment(3));?>
<p><input type="text" name="title" value="<?=$row->title?>" /></input></p>
<p><textarea><?=$row->body?></textarea></p>
<p><input type="submit" value="Zapisz zmiany" /></p>
</form>
<?php endforeach;?>
</div>
</div>
</body>
<?=$this->load->view('footer');?>
</html>
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?