• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Could not redirect to...

#1
[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 />";
}
?&gt;
===========================================================================================
Here's my create.php view

&lt;?php echo form_open('blog/createpost'); ?&gt;
<label>Title</label>
&lt;input type="text" name="title" size="30" /&gt;&lt;br />

<label>Message</label>
&lt;textarea name="message" cols="50" rows="10"&gt;&lt;/textarea><br />

&lt;input type="submit" value="CREATE POST" /&gt;
===========================================================================================
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?

#2
[eluser]Beginers[/eluser]
provide your errors!!

#3
[eluser]Rolly1971[/eluser]
to make it easier for us to help you please wrap your code snippets in the bb - code tag.

also, provide us with any error message your are getting.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.