Jump to content

ExcelLink is not getting 'off'..


RRVARMA

Recommended Posts

Hi,

 

I'm facing problem with the script below. Actually its a pagination where the user can download any page he wishes. Here i've put only 'Previous1'. But there are Next page, Last Page and First Page links.

 

The problem i'm facing is : Once i click the download to Excel, and then click the 'PREVIOUS PAGE' link its again activating the download thing. As i'm new to this PHP i'm not able to understand why its not working properly. Download to excel link is working properly. Previously before adding the download to excel link everything was fine with the pagination thing. But problem raised when i put the script for downloading the reports to excel.

 

Please help.

 

 
<FORM name='form1' method=post action=pineapple.php>
<INPUT TYPE=HIDDEN name=ExcelLink value="off">
<INPUT TYPE=HIDDEN name=Previous1 value="off">
<INPUT TYPE=HIDDEN name=Next2 value="off">
<INPUT TYPE=HIDDEN name=first1 value="off">
<INPUT TYPE=HIDDEN name=last2 value="off">
------------
------------


<?php

if(strtolower($Previous1) == "on")
{

$TOTAL_ROWS= $MAX_ROWS - $start2 + 1;
$start2= $start2 - $TOTAL_ROWS;
$MAX_ROWS= $MAX_ROWS - $TOTAL_ROWS;

}

if(strtolower($ExcelLink) == "on")
{
  Header("Content-Type: application/vnd.ms-excel");
  Header("Content-Disposition: attachment; filename=Total_Fruits_Month.xls");

}

--------------------------
--------------------------
##########other actual scripts which doesn't concern the current prob.##############
--------------------------
--------------------------

if(strtolower($ExcelLink) != "on")
{

	  echo "<CAPTION><BODY><COLOR=#0000CF><A href=\"javascript:this.document.form1.Previous1.value='on';this.document.form1.submit();\">PREVIOUS PAGE</A></CAPTION> ";



  echo "<CENTER><BODY><A href=\"javascript:this.document.form1.ExcelLink.value='on';this.document.form1.submit();\">Download</A> to Excel";

}

?>
</FORM>


 

Thanks,

RRVARMA

Link to comment
Share on other sites

I think you need to stick  this.document.form1.ExcelLink.value='off'  in the  PREVIOUS_PAGE link maybe, since probably the value is still on and that means download?

 

Would be helpful if you could post the js (unless this is all some weird ms object thing where you don't need it?)

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.