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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:31:51+00:00 2026-06-16T00:31:51+00:00

i am developing an application where i need some suggestions. Here is the detail

  • 0

i am developing an application where i need some suggestions. Here is the detail of the problem.

public function form()
{
    $this->load->helper('inflector');
    $id =   $this->uri->segment(3,0); 

    if($data = $this->input->post()){
        $result =   $this->form_validation->run();
        if($result){
            if($id > 0){
              // here update code
            }else{
                $this->mymodel->insert($data);
                $this->session->set_flashdata('message','The page has been added successfully.');
                $this->redirect =   "mycontroller/index";
                $this->view     =   FALSE;
            }
        }else{
            //$this->call_post($data);
            $this->session->set_flashdata('message','The Red fields are required');
            $this->view     =   FALSE;
            $this->redirect =   "mycontroller/form/$id";
        }
    }else{

        $row    =   $this->mymodel->fetch_row($id);
        $this->data[]=  $row;
    }
}


public function _remap($method, $parameters)
{
    if (method_exists($this, $method))
    {
        $return =   call_user_func_array(array($this, $method),$parameters);
    }else{
        show_404();
    }

    if(strlen($this->view) > 0)
    {
        $this->template->build('default',array());

    }else{
        redirect($this->redirect);
    }   
}   

Here you can see how i am trying to reload the page on failed validation.
Now the problem is that i have to display the flash data on the view form which is only available after redirect and i need to display the validation errors to which are not being displayed on redirect due to the loss of post variable. If i dont use redirect then cant display flashdata but only validation errors. I want both of the functionalities togather. I have tried even creating POSt again like this

public function call_post($data)
{
    foreach($data as $key => $row){
        $_POST[$key]    =   $row;
    }   
}

Which i commented out in the formmethod.How can i achieve this.

  • 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-16T00:31:52+00:00Added an answer on June 16, 2026 at 12:31 am

    Here’s a thought.

    I think you can add the validation error messages into the flash data. Something like this should work:

    $this->session->set_flashdata(‘validation_error_messages’,validation_errors());

    Notice the call to the validation_errors function. This is a bit unconventional, but I think it should work. Just make sure that the code are executed after the statement $this->form_validation->run(); to make sure the validation error messages are produced by the Form Validation library.

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

Sidebar

Related Questions

I am developing .net application.I need some good looking registraion form using jquery. please
I'm developing an application through Core Data and I need to perform some calculation
Am developing a sample application for some administration activities. I need to know how
I am developing a web application. For some reasons, I need to use external
I'm developing an iPhone OpenGL application, and I need to use some textures with
i'm developing cakephp application. i need some specific characters in url, like & (ampersand),
I'm in need of some help in developing a desktop application with a pre-populated
I am developing an application for iPhone.I need to give some labels an emboss
I am in need of some further information. I am developing a small application
I am developing an application where I need to know some of my iphone

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.