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

  • Home
  • SEARCH
  • 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 5983283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:12:30+00:00 2026-05-22T22:12:30+00:00

This may be a n00b topic but, anyways, I have been having a rather

  • 0

This may be a n00b topic but, anyways, I have been having a rather difficult and strange time with this bug. Basically I was working on a controller method for a page that displays a form. Basically, I was debugging the form’s submitted data by var dumping the form input using codeigniter’s $this->input->post function like so:

var_dump($this->input->post('first_name'));

Every other day this has worked, but today I was finding that when I dumped post variables to the browser it would return false as if they had no values even though they did have values when I submitted the form. Then I tried accessing the variables through PHP’s POST superglobal array directly like so:

var_dump($_POST['first_name']);

and that returned empty as well so then I tried dumping the entire post array like so:

var_dump($_POST);

and it was empty as well despite the fact that I filled out the entire form. Nevertheless, the records in my MySQL database were being updated (which means that the form was submitting even though my $_POST variables appeared empty).

Also, I reasoned that normally, if I var dumped variables in the controller function before a redirect function call that it should give me a ‘Headers already sent’ error but it never did. It just redirected me to the supposed success page instead of dumping my variables.

So for the about 2 hours I thought that my POST data wasn’t being sent and re-checked the code for errors and began commenting out statements one by one until I could find the culprit statement in my script.

Finally, I commented out a chunk of code that sets a success message an redirects, like so:

/*
if($record_updated_successfully)
{
    $this->session->set_flashdata('success', $this->lang->line('record-updated-successfully'));
}
redirect('admin/success_page');
*/

and only then did the script start dumping out all my previous variable dumps using codeigniter’s $this->input->post function as well as the $_POST superglobal array.

So ok, if the script does indeed redirect me despite the variable dumps sending output before headers are sent then I can see why the $_POST variables would appear empty.

So then the real question is why the script would still redirect despite my sending of output before headers are sent? Has anyone ever experienced this?

Any help with this would be appreciated.

EDIT: with respect to loading the view here’s a simplified version of my script looks like
with the debugging var dump statements:

function some_controller_method() {
    var_dump($this->input->post());
    var_dump($_POST);

    // some code

    if($this->input->post('form_action') == 'update record') {
        // code that runs when the form is submitted
        /*
         * ...
         */

        if($record_updated_successfully)
        {
            $this->session->set_flashdata('success', $this->lang->line('record-updated-successfully'));
        }
        redirect('admin/success_page');
    }

    $this->load->view('my-view-file.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-22T22:12:30+00:00Added an answer on May 22, 2026 at 10:12 pm

    While I can’t be sure, I’m going to assume you were outputting things like the var_dump() in your view file. A view is not executed at the time you call it, for example:

       $this->load->view('some_view');
       echo "hi!";
    

    In a controller will not result in the contents of some view followed by “hi”. It will results in “hi” followed by the contents of some view. The view is actually output after everything else in the controller has run.

    This is the only thing that comes to mind with the information you’ve presented. I’d have to see more code to offer a different diagnosis.

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

Sidebar

Related Questions

This may sound strange but sometimes when your ASP.NET webapp isn't working and you
This may be a doozy, but does anyone have an idea how to: Pass
This may have been asked before and I just can't find it. I have
This may be a no-brainer for the WPF cognoscenti, but I'd like to know
This may seem like a daft question, but i was wondering about how to
This may be simple one, but 5 mins of Googling didn't give me the
This may be a simple fix - but I'm trying to sum together all
This may be a matter of style, but there's a bit of a divide
This may be an oxymoron, but how would one update a data entity in
This may not be the correct way to use controllers, but I did notice

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.