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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:32:27+00:00 2026-05-24T21:32:27+00:00

i want when there is value flashdata echo id=’error_text’ with $this>session>flashdata(‘error’) . how is

  • 0

i want when there is value “flashdata” echo id='error_text' with $this>session>flashdata('error'). how is it?
this code have error:

   <?php
      isset($this->session->flashdata('error'))
      {
          "<div id='error_text'>" . $this->session->flashdata('error') . "</div>"}
    ?>

error:

Fatal error: Can’t use method return value in write context in
D:\xampp\htdocs\mehdi\system\core\Loader.php(679) : eval()’d
code on line 2

if use of this:

#error_text {
    background-color: #000000;
}
<div id="error_text"><?=$this->session->flashdata('error');?></div>

if $this->session->flashdata('error') not show message background it always is black (#error_text{background-color: #000000;}).

EDIT:

in controller:

if ($this->db->count_all($this->_table) == 0) {
        $this->session->set_flashdata('error', 'Error have.');
        $error = isset($this->session->flashdata('error')) ? $this->session->flashdata('error') : FALSE; // Line 36
        redirect('admin/accommodation/insert');
        } else {
        return 0;
        }

in view:

<?php if($error){"<div id='error_text'>".$this->session->flashdata('error')."</div>"}?>

new error:

Fatal error: Can’t use method return value in write context in
D:\xampp\htdocs\Siran-mehdi\application\controllers\admin\accommodation.php
on line 36

  • 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-24T21:32:28+00:00Added an answer on May 24, 2026 at 9:32 pm

    You need to transfer the flashdata into variable at the first place. And do that in your controller, then send it to view. Its better to separate logic from presentation.

     if ($this->db->count_all($this->_table) == 0) 
     {
        $this->session->set_flashdata('error', 'Error have.');
        // You doesn't need that here...
        // $error = isset($this->session->flashdata('error')) ? $this->session->flashdata('error') : FALSE; // Line 36
        redirect('admin/accommodation/insert');
     } 
     else 
     {
        return 0;
     }
    
    
    // Then for validate, in 'admin/accommodation/insert'
    $error = $this->session->flashdata('error');
    
    $data = array();
    
    //...
    
    $data['error'] = $error;
    $this->load->view('someview',$data);
    
    // And in your view file
    <?php if($error) : ?>
    <div id="error_text"><?php echo $error ?></div>
    <?php endif; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For any given type i want to know its default value. In C#, there
I want to trap values that are like this (in which there is not
I am using VBScript for programming I have three vairables and there value is
I have a global variable in my javascript, whose value I want to set
I want there to be CDATA sections in my output XML. I have tried
I have this routine which is called onmouseover of a certain element. I want
I don't want to give an initial value. I want to set these later
I want to pad some percentage values so that there are always 3 units
I have an IDictionary, now I want to use these values in a selectlist.
i want to know there a limitation in size for an iphone to display

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.