Could not redirect to... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Could not redirect to... (/showthread.php?tid=54251) |
Could not redirect to... - El Forum - 08-30-2012 [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? Could not redirect to... - El Forum - 08-30-2012 [eluser]Beginers[/eluser] provide your errors!! Could not redirect to... - El Forum - 08-30-2012 [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. |