[eluser]stuffradio[/eluser]
I'm doing a comment script. When I submit the form to insert a comment, WAMP stops responding. It only happens on this specific page.
The form
Code:
<?php
echo form_open('picture/comment');
echo form_textarea('comment');
echo '<br />';
echo form_hidden('photo_id', $image_id);
echo form_submit('submitit', 'Submit comment!');
echo form_close();
?>
Controller
Code:
function comment()
{
$this->comments->photo_id = $this->input->post('photo_id', true);
$this->comments->poster = $this->session->userdata('logged_in');
$this->comments->comment = $this->input->post('comment', True);
$this->comments->insert();
redirect('/picture/id/'.$this->input->post('photo_id'));
}
Model
Code:
<?php
class Comments extends Model
{
var $photo_id;
var $poster;
var $comment;
var $posted;
function Comments()
{
parent::Model();
}
function insert()
{
if ($this->photo_id)
{
$content = array(
'photo_id' => $this->photo_id,
'poster' => $this->poster,
'comment' => $this->comment,
'posted' => $this->posted);
$this->insert('pb_comments', $content);
}
}
}