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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:59:34+00:00 2026-05-19T21:59:34+00:00

unfortunately this question may get closed but i hope some people answer it. I

  • 0

unfortunately this question may get closed but i hope some people answer it.

I have some PHP code that opens excel with some html data in it. This is the PHP:

<?php
$data = $_REQUEST['datatodisplay'];
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=Data.xls");
header("Pragma: no-cache");
header("Expires: 0");

echo $data;

?>

And this is the form:

<form class='noPrint' action='demo/saveToExcel.php' method='post' target='_blank'
onsubmit="$('#datatodisplay').val( $('<div>').append( $('#dataTable').eq(0).clone() ).html() )">
<input id='excel' type='image' src='img/file.png'>
<input type='hidden' id='datatodisplay' name='datatodisplay' />
</form>

Now, this code works great, but could someone explain from a PHP perspective how it does this, ie. i submit the form, it opens a new page temporarily, comes up with a download box, i hit open in Excel and then i’m sent back to the form page (but with Excel also open)

How does PHP know that i’ve actioned the download and to return to the form page?

  • 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-19T21:59:35+00:00Added an answer on May 19, 2026 at 9:59 pm

    It doesn’t. Your browser never left the form page in the first place, since the file was downloaded instead of shown in the browser.

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

Sidebar

Related Questions

This question may have been asked already - but unfortunately, I could not find
I have a feeling I may already know the answer to this question, but
I understand that this question may seem somewhat ungrounded, but if someone knows anything
I know this may not be exactly a coder question, but I feel it
I know this may seem like a silly question and I have attempted to
This question may be beyond the scope of a simple answer here at stack
This question is coded in pseudo-PHP, but I really don't mind what language I
This may be a newbie question, but i want to avoid buffer overflow. I
I've seen a couple similar threads to this question, but none of them really
This question is a spin-off/evolution of this question . (That question got marked as

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.