[eluser]boomr[/eluser]
Heey every body
i have a same problem
whit submitting a form
if i try to post a comment i get the error
Disallowed Key Characters.
and then if i press renew i get
A Database Error Occurred
You must use the “set” method to update an entry.
here’s my code
blog.php
Code:
<?php
class Blog extends controller {
function Blog()
{
parent::Controller();
$this->load->helper(‘url’);
$this->load->helper(‘form’);
}
function index()
{
$data[‘title’] = “My Blog Title”;
$data[‘heading’] = “My Blog Heading”;
$data[‘query’] = $this->db->get(‘entries’);
$this->load->view(‘blog_view’, $data);
}
function comments()
{
$data[‘title’] = “My comment Title”;
$data[‘heading’] = “My comment Heading”;
$this->db->where(‘entry_id’, $this->uri->segment(3));
$data[‘query’] = $this->db->get(‘comments’);
$this->load->view(‘comment_view’, $data);
}
function comment_insert()
{
$this->db->insert(‘comments’, $_POST);
redirect(‘blog/comments/’.$_POST[‘entry_id’]);
}
}
?>
comment_view.php
Code:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
<?php if ($query->num_rows() > 0): ?>
<?php foreach($query->result() as $row): ?>
<?=$row->body?>
<?=$row->author?>
<hr>
<?php endforeach; ?>
<? endif; ?>
<?=anchor(‘blog’, ‘back to blog’);?>
<?=form_open(‘blog/comment_insert’);?>
<?=form_hidden(‘entry_id,’, $this->uri->segment(3));?>
<textarea name=“body” rows=“10”></textarea>
<input type=“text” name=“author” /></p>
<input type=“submit” value=“Submit Comment”/></p>
</body>
</html>
blog_view.php
Code:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
<?php foreach($query->result() as $row): ?>
<?=$row->title?>
<?=$row->body?>
<?=anchor(‘blog/comments/’.$row->id, ‘Comments’);?>
<hr>
<?php endforeach; ?>
</body>
</html>
already thanks for the help