Welcome Guest, Not a member yet? Register   Sign In
Beginner Problem
#1

[eluser]gunner0007[/eluser]
Hi guys, I am a complete newbie. I have read the user guide countless times trying to figure this out, searched google enough times as well with no luck so far. I'm new to CodeIgniter and just making a simple blog. Can someone help me out here? Here is what I have so far.. If it doesn't make sense , which it may not I'll just have to do another search but I'm having problems inserting data into my post data into the database. I'm able to pass the post as a variable and echo it to see what it is. However when trying to insert it via command in the model nothing happens.

Controller
<?php



public function update() {
$this->load->helper('form');

$data['heading'] = 'Enter Info Here';
$data['title'] = 'Update Blog';


$this->load->model('news_model');

$data['data'] = $this->news_model->insert_blog();

$this->load->view('update_blog',$data);

}
}
?>

Model
class News_model extends CI_Model {

public $content = '';


public function News_model() {
parent::__construct();

public function insert_blog() {

$this->load->database();

$this->load->library('input');
$data = $this->input->post('entry');

$this->content = $this->input->post('entry');

$data = array( 'Content' => $this->input->post('entry'));



$this->db->insert('blog', $data);
}



}
?>

View

<html>

<title><?php echo $title?></title>

<h2>&lt;?php echo $heading?&gt;</h2>

&lt;?php
echo form_open('blog/update');

echo form_textarea('entry','Enter Information Here');
echo '<br />';

echo form_submit('mysubmit', 'Add Post!')
?&gt;

&lt;/html&gt;


Messages In This Thread
Beginner Problem - by El Forum - 07-03-2012, 12:50 PM
Beginner Problem - by El Forum - 07-03-2012, 11:52 PM
Beginner Problem - by El Forum - 07-04-2012, 12:11 AM
Beginner Problem - by El Forum - 07-04-2012, 07:42 AM
Beginner Problem - by El Forum - 07-09-2012, 10:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB