Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7493311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:53:20+00:00 2026-05-29T16:53:20+00:00

We started following the CakePHP Blog tutorial hosted on the website cakephp.org – http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html

  • 0

We started following the CakePHP Blog tutorial hosted on the website cakephp.org – http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/part-two.html

At this point we’re stuck on the redirecting after submitting a form (i.e. function edit / add). This is how our code looks like:

public function edit($id = null) {
    $this->Post->id = $id;

    if ($this->request->is('get')) {
        $this->request->data = $this->Post->read();
    } else {
        if ($this->Post->save($this->request->data)) {
            $this->Session->setFlash('Your post has been updated.');
            $this->redirect($this->referer());
        } else {
            $this->Session->setFlash('Unable to update your post.');
        }
    }
}

After commenting the line $this->redirect($this->referer()); the page is refering to his own… with the line added it’ll stay on a empty white page.

Example: http://www.drukwerkprijsvergelijk.nl/posts/

Please help this little kittens, we’re desperate.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:53:21+00:00Added an answer on May 29, 2026 at 4:53 pm

    you cannot use referer() on edit. thats because after the first POST the referer is the same page as you are on right now.
    referer() can only be used for redirects if there was no form post on this page (delete for example or edit/add right after accessing the page).
    but even with delete() you must be careful. coming from “view” would result the redirect to run into a redirect loop…

    you can store the referer in the form as hidden field and use this to redirect back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following the Auth tutorial and in this stage http://book.cakephp.org/view/1547/Acts-As-a-Requester aros table is not
I am following the http://wiki.fluentnhibernate.org/Getting_started tutorial to create my first NHibernate project with Fluent
I've just started playing with Django and am loosely following the tutorial with my
While following the instructions on the CakePHP book to create an ACL controlled site
I have recently started following the examples from The Little Schemer and when trying
I got started by following this awesome tutorial , but wanted to do the
I've got a vanilla Eclipse, installed the ADT and started following some tutorials. Mostly
I have started learning cakePHP and now I am facing the following problem. How
I have only just started received the following error in my windows forms application
I have the following text: started: Project: ProjectA, Configuration: Release Any CPU ------ I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.