RRVARMA Posted May 21, 2008 Share Posted May 21, 2008 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 Quote Link to comment Share on other sites More sharing options...
littledragon Posted May 21, 2008 Share Posted May 21, 2008 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?) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.