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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:23:09+00:00 2026-05-25T18:23:09+00:00

I am relatively new to CodeIgniter, so I’m not sure if this is just

  • 0

I am relatively new to CodeIgniter, so I’m not sure if this is just bad coding, or if it is a problem with how I’m using CodeIgniter’s flash data. For context: the user submits a phrase in a simple HTML form. The phrase is compared against what should be typed in (pretty simple, right?). This correct phrase changes based upon what step in the activity they are on. When they get the text wrong, I am attempting to use flashdata to show the error message. Here are the controller portions, followed by the view:

//Get step number
$step = $this->input->post('step');
$correct_text = array(
1 => 'TESTPHRASE',...
...

//If user enters the correct text           
$entered_text = strtoupper($this->input->post('entered_text'));
        if ($entered_text == $correct_text[$step]) 
        {   
            ...
        }
        //If user enters the incorrect text
        else 
        {
                $data['step'] = $step;
                $this->session->set_flashdata('entry_error', '<b>Sorry!</b>Your entry was incorrect. Be sure to carefully read the instructions!');
                $this->load->view('template', $data);
        }

Here is the view that only runs every other time.

<?php 
if ($this->session->flashdata('entry_error'))
{ ?>
   <div id="game_error">
   <?php echo $this->session->flashdata('entry_error'); ?>
   </div>
<?php } ?>
  • 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-25T18:23:10+00:00Added an answer on May 25, 2026 at 6:23 pm

    From the docs: CodeIgniter supports “flashdata”, or session data that will only be available for the next server request, and are then automatically cleared.

    You are setting the flashdata and then trying to access it during the same request. It’s not available until the next request which is why it seems like it’s only working every other time.

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

Sidebar

Related Questions

Being relatively new to functional programming, I expend lots of energy wondering is this
Caveat: I'm relatively new to coding as well as TextMate , so apologies if
I'm relatively new to web application programming so I hope this question isn't too
I am relatively new to c# and the event handling concept. Inside this function
I am a relatively new programmer so this may be a really simple question
I'm relatively new to CodeIgniter and am making my first CI project in which
Relatively new to mySQL so this is probably an easy one: I have a
Relatively new to Cocoa here. This question is about NSFileHandle, but I got a
I'm relatively new to using jsoup, and I can't seem to find the correct
I am relatively new to codeigniter and am struggling to understand how would save

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.