CodeIgniter Forums

Full Version: CI blank page without saying anything
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hello, i was following a tutorial from nettuts (CodeIgniter Essentials) and i was making a blog.

Everything worked fine untill i had to make a method to edit posts. This is where the problems appears.
I've followed every single step from the tutorial and i did exactly the same thing but mine is crashing. I've tried to enable the profiler tool but with no luck :/ Im only getting a white screen whenever im submiting the changes.

This is the code from my controller:

Code:
function editpost($postID)
{
  $this->output->enable_profiler(TRUE);
  $data['success'] = 0;
  if($_POST)
  {
   $data_post = array(
    'title' => $_POST['title'],
    'post' => $_POST['post'],
    'active' => 1
   );
   $this->post->update_post($postID, $data);
   $data['success'] = 1;
  }
  $data['post'] = $this->post->get_post($postID);
  $this->load->view('edit_post', $data);
}

its exactly the same with the tutorial!

The model:

Code:
function update_post($postID, $data)
{
  $this->where('postID', $postID);
  $this->db->update('posts', $data);
}

And the view is a very simple page:

Code:
<?php if($success == 1): ?>
   <div class="success">Post edited successfully</div>
  &lt;?php endif; ?&gt;

  &lt;form action="&lt;?= base_url(); ?&gt;posts/editpost/&lt;?= $post['postID'] ?&gt;" method="POST"&gt;
   Title:
   <p>&lt;input type="text" name="title" value="&lt;?= $post['title'] ?&gt;"&gt;&lt;/p>
   Body:
   <p>&lt;textarea name="post" cols="30" rows="10"&gt;&lt;?= $post['post'] ?&gt;&lt;/textarea&gt;&lt;/p>
   <p>&lt;input type="submit" value="Save post"&gt;&lt;/p>
  &lt;/form&gt;

What am i doing wrong? Is there any problem with the version? The guy in the videos is using 2.1 and im using the latest.