PDA

View Full Version : Downloads for multiple item orders


Heckie
07-08-2009, 08:38 AM
I have created a page where customers can retrieve MP3 files that they have purchased.

I've noticed that when I add a Download button into my orderdetails.php page and it repeats for multiple items, every time I click on it, it downloads the same file (the top item in the results table) instead of the correct one.

This is my form containing the button:

<form method="post" name="downloadform" id="downloadform">
<input name="download" type="image" id="download" value="Download" src="../images/design/download2.gif" alt="Download" />
</form>

and the DFP2 SQL:

<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_DownloadFile("WA_DownloadResult1", "../downloads/", "".$row_WADAorderdetails['DetailDownloadFile'] ."", "[FileName]", false, false, false, "", "", "", "");
}
?>

Ray Borduin
07-08-2009, 08:57 AM
You would want to add a hidden form element to your form to store the correct OrderDetailsID for that item.

Then create another recordset that you filter by that hidden form element to get the correct row.

Then refer to that recordset in your download so that the correct row is downloaded according to the form submitted (actually driven by the hidden form element and a new recordset).

Heckie
07-08-2009, 09:23 AM
Thanks Ray, that seems to work.