Search Results

Search found 1 results on 1 pages for 'nemops'.

Page 1/1 | 1 

  • Codeigniter - change url at method call

    - by NemoPS
    I was wondering if the following can be done in codeigniter. Let's assume I have a file, called Post.php, used to manage posts in an admin interface. It has several methods, such as index (lists all posts), add, update, delete... Now, I access the add method, so that the url becomes /posts/add And I add some data. I click "save" to add the new post. It calls the same method with an if statement like "if "this-input-post('addnew')"" is passed, call the model, add it to the database Here follows the problem: If everything worked fine, it goes to the index with the list of all posts, and displays a confirmation BUT No the url would still be posts/add, since I called the function like $this-index() after verifying data was added. I cannot redirect it to "posts/" since in that case no confirmation message would be shown! So my question is: can i call a method from anther one in the same class, and have the url set to that method (/posts/index instead of /posts/add)? It's kinda confusing, but i hope i gave you enough info to spot the problem Cheers!

    Read the article

1