[eluser]rochellecanale[/eluser]
help me i have a minimal problem and i dont know what to do i hope that you can help me guys.
===========================================================================================
Here's my controller:
<?php
class Blog extends CI_Controller{
public function __construct(){
parent::__construct();
$this->load->model('blogmodel');
$this->load->library('form_validation');
}
public function index(){
$data['webtitle'] = 'Post List';
$data['pageheader'] = 'Blog List';
$data['post'] = $this->blogmodel->getAllPost();
$this->load->view('templates/header',$data);
$this->load->view('blogs/view',$data);
}
public function createpost(){
$data['webtitle'] = 'Create Post';
$data['pageheader'] = 'Create New Post';
$this->form_validation->set_rules('title','Title','required');
$this->form_validation->set_rules('message','Message','required');
if($this->form_validation->run() === FALSE){
$this->load->view('templates/header',$data);
$this->load->view('blogs/create');
}else{
$this->load->view('blogs/success');
}
}
}
===========================================================================================
Here's my view named 'view.php' for displaying post and provide a link for adding new post
<?php
echo "<a href='blog/createpost'>ADD NEW POST?</a><BR />";
foreach($post as $row){
echo "ID: ".$row['id']."<br />";
echo "TITLE: ".$row['title']."<br />";
echo "MESSAGE: ".$row['body']."<br />";
echo "DATE CREATED: ".$row['created']."<br />";
echo "DATE MODIFIED: ".$row['modified']."<br />";
echo "<hr />";
}
?>
===========================================================================================
Here's my create.php view
<?php echo form_open('blog/createpost'); ?>
<label>Title</label>
<input type="text" name="title" size="30" /><br />
<label>Message</label>
<textarea name="message" cols="50" rows="10"></textarea><br />
<input type="submit" value="CREATE POST" />
===========================================================================================
The problem is i cannot redirect the page to create.php which is my view in creating a new post. How can i solve my link problem?