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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:16:09+00:00 2026-05-26T16:16:09+00:00

In the CodeIgniter framework I have a form action that posts the id of

  • 0

In the CodeIgniter framework I have a form action that posts the id of a number of checkboxes to a controller. The controller checks each id to ensure it is valid, and then prints off a pdf document. This works fine.

So, my current method is /items, and I am posting to the /documents method

function documents()
  if ($this->input->post() && validate_documents())
  {
    $this->load->library('Print_docs');
    $this->print_docs->execute($this->input->post());
  }
}

So, if the docs get printed, then this works fine: the user remains on the /items method and pdf is offered as a download in the browser.

If, however, validate_documents() is false, then I dont want anything to happen – i.e. the user should remain on the /items method. However, what is actually happening is that the user is somehow being redirected to the /documents method – and the browser is blank.

So, why is the user being redirected to the /documents method? And how do I keep the user on the /items method no matter what?

  • 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-26T16:16:09+00:00Added an answer on May 26, 2026 at 4:16 pm

    A form post is a page refresh. When the pdf is generated, the page “refresh” is actually you downloading the pdf – so the browser doesn’t take you away from the /items method — it’s the same as if you open a link with target="_blank", the page is opened in a new window and the current page is untouched.

    You can do 1 of 2 things here:

    1. Redirect if there is an error in the documents method back to /items
    2. Submit the form via ajax, so whether there is an error or not, you stay on /items
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the CodeIgniter PHP framework. I have a simple form that has an
I am using Codeigniter framework and I have a form with input fields. When
I have been working on a web development library (for the CodeIgniter framework) that
I have a website that I built on the CodeIgniter framework. It implements the
I'm using CodeIgniter (a PHP framework) to build an app, and I have an
I am using codeigniter framework. where should i sanitize PHP input - controller or
We're building a PHP app based on Good old codeigniter framework and have run
I am using CodeIgniter framework for PHP. It requires that index.php should be there
I have a web application built with jQuery Mobile and PHP (CodeIgniter framework). Now
If you have worked with some of the frameworks like CodeIgniter or KohanaPHP, then

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.