Jump to content

Exporting data to Excel prevents page refresh


radi8

Recommended Posts

I have a script that will export data to excel. After the export, I need the page to reload showing status information, but it does not reload.

 

What could be causing an issue like this? I think that because the export forced the download file dialogue to open, those headers may be preventing the form from reloading properly, but how, why, and what can be done to resolve the issue?

Link to comment
Share on other sites

Hey all stupid question.

 

I am going to try the javascript thing to close the browser when the Export is completed. But, can someone give me an idea on how to force the javascript to fire AFTER the download is complete?

 

Any help is appreciated.

 

Here is my basic structure of the new mover.html.php page:

 

<?php
        //session_start();
        include_once $_SERVER['DOCUMENT_ROOT'] .'/inc/standardFunctions.inc.php'; 
        //phpinfo();
        $dodebug=1;
        if($dodebug > 0)
        {
            ini_set ("display_errors", "1");
            //error_reporting(E_ALL);
            error_reporting(-1);
            echo "<pre>";
            switch($dodebug)
            {
                case 1:
                    echo "--> Form data (POST) <-- <br>";
                    print_r ($_POST);
                    echo "--> Form data (GET) <-- <br>";
                    print_r ($_GET);
                    echo "--> Header List <-- <br>";
                    //var_dump(headers_list());
                    print_r(headers_list());
                    break;
                case 2:
                    echo "--> Form data (POST) <-- <br>";
                    print_r ($_POST);
                    echo "--> Form data (GET) <-- <br>";
                    print_r ($_GET);
                    echo "--> Form data (SESSION) <-- <br>";
                    print_r ($_SESSION);
                    break;
                case 3:
                    echo "--> Form data (POST) <-- <br>";
                    print_r ($_POST);
                    echo "--> Form data (GET) <-- <br>";
                    print_r ($_GET);
                    echo "--> Form data (SESSION) <-- <br>";
                    print_r ($_SESSION);
                    echo "--> Form data (SERVER) <-- <br>";
                    print_r ($_SERVER);
                    break;
                case 4:
                    echo "--> PHP Info <-- <br>";
                    phpinfo();
                default: 
                    echo "--> Form data (POST) <-- <br>";
                    print_r ($_POST);
                    break;
            }
            echo "</pre>";
        }
        else
        {
            ini_set ("display_errors", "0");
            error_reporting(0);
        }    
?>
<html>
<head>
</head>
<?php
    $process = $_GET['process'];
    if(isset($_GET['cname']))$cname=$_GET['cname'];
    else $cname='';
    switch ($process)
    {
        case 1:
            exportTruckingCompanies();
            break;
        case 2:
            exportDropFees();
            break;
        case 3:
            exportDomesticRates($cname);
            break;
        case 4:
            exportCanadianRates();
            break;
        case 5:
            exportFuelCurchargeRates();
            break;
        default:
            break;
    }
    ?>
<body>
<p>File download in process</p>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.