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 8664775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:19:29+00:00 2026-06-12T17:19:29+00:00

This is CakePHP 1.3 I have a 5-step order form that stores the new

  • 0

This is CakePHP 1.3

I have a 5-step order form that stores the new session data after each step. This works perfectly every step, until the last step where the user completes the order.

On the last step, I save the order, then set a session flag to say it’s been completed. This way, if the user refreshes the page it won’t put through another order again.

The problem is, I set the flag in the session and if I debug the session it’s there. On page refresh, the session has reverted completely to how it was before, without the new values.

// Controller action for step 5 of the form

public function step5() {

    // FIRST DEBUG
    debug($this->Session->read('order'));

    // Load from session so that the view can display the order information
    $this->data = $this->Session->read('order');

    // Save order if not already completed
    if (!$this->Session->check('order.complete')) {

        // Adds to the database
        if ($this->_saveOrder($this->data)) {

            // Set flag so if the user refreshes, it won't save again
            $this->Session->write('order.complete', true);

            // SECOND DEBUG
            debug($this->Session->read('order'));

        }
    }
}

In the first debug when the page loads, the session looks like this:

Array
(
    [Order] => Array
        (
            [value1] => 4566
            [value2] => 'test'
            [value3] => 0
            [value4] => 0
        )
    [Customer] => Array
        (
            [fname] => test
            [sname] => test
            [email] => test@torg.co.uk
            [tel] => 0123456789
        )

)

Then the second debug shows that the new session flag has been written to the session:

 Array
(
    [Order] => Array
        (
            [value1] => 4566
            [value2] => 'test'
            [value3] => 0
            [value4] => 0
        )
    [Customer] => Array
        (
            [fname] => test
            [sname] => test
            [email] => test@torg.co.uk
            [tel] => 0123456789
        )
    ['complete'] => true

)

But then if I refresh the page, the complete flag is gone, the session has reverted entirely back to how it was before, and the save runs again because the flag isn’t there. There is NO code after the flag is written so it isn’t being deleted.

Array
(
    [Order] => Array
        (
            [value1] => 4566
            [value2] => 'test'
            [value3] => 0
            [value4] => 0
        )
    [Customer] => Array
        (
            [fname] => test
            [sname] => test
            [email] => test@torg.co.uk
            [tel] => 0123456789
        )

)

The session writing works fine on all other steps. I can add/update session variables between pages and they work fine and persist across pages and page refreshes.

I don’t know if this is something to do with my config settings or what. I don’t know why this is happening just on this page. I also noticed sometimes, very rarely, after tearing my hair out for AGES and clearing the cache a few times, etc. it will seem to briefly work once, then stop working again.

Could it be anything to do with my config settings? Here is my Config/core.php without the comments:

Configure::write('debug', 2);

Configure::write('log', true);

Configure::write('App.encoding', 'UTF-8');

Configure::write('App.baseUrl', 'components/com_cake/app');

//Configure::write('Routing.prefixes', array('admin'));

//Configure::write('Cache.disable', true);

//Configure::write('Cache.check', true);

define('LOG_ERROR', 2);

Configure::write('Session.save', 'php');

//Configure::write('Session.model', 'Session');

//Configure::write('Session.table', 'cake_sessions');

//Configure::write('Session.database', 'default');

Configure::write('Session.cookie', 'CAKEPHP');

Configure::write('Session.timeout', '120');

Configure::write('Session.start', true);

Configure::write('Session.checkAgent', true);

Configure::write('Security.level', 'medium');

Configure::write('Security.salt', 'd1a4bfb8a3cxxxxx47173663e9e2e9ea5');

Configure::write('Security.cipherSeed', '1269383xxxxxxxxxx3672219');

Configure::write('Asset.timestamp', 'force');

//Configure::write('Asset.filter.css', 'css.php');

//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');

Configure::write('Acl.classname', 'DbAcl');
Configure::write('Acl.database', 'default');

//date_default_timezone_set('UTC');

Cache::config('default', array('engine' => 'File'));
  • 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-06-12T17:19:30+00:00Added an answer on June 12, 2026 at 5:19 pm

    This took me absolutely forever to figure out, but the problem was actually that I was using a CakePHP component inside the Joomla framework, and I had to select a different database using PHP’s native mysqli functions instead of Cake’s database abstraction layer.

    What happened was that I changed the selected MySQL database, and this caused loads of subtle and seemingly unexplainable problems that came from Joomla but were only apparent in Cake.

    The solution was to ensure that I switched back to the database that Joomla requires, in my AppController::beforeRender() method.

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

Sidebar

Related Questions

I'm new to cakephp and following this tutorial. http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html I have created the blog
Working with cakePHP this is my situation: I have Users and Order s. Order
I have a CakePHP 1.3 application that has a login system, which works well.
This is for Cakephp. I have a data with Finnish language. Is there a
I have some code that's run within a method (it's a CakePHP view): This
So I have this one CakePHP web application that I'm trying to refactor. There
Please have a look at this validation array in my cakephp app for model
do you test this url in your application that writted with cakephp ? www.yourCakephpApp.com/test
i'm very new to this cakephp & i got an assignment to fix an
I have the following code in the controller: function add() { if (!empty($this->data)) {

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.