close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Create download button in a Data Assist Results table

Thread began 9/08/2009 8:20 pm by peter383096 | Last modified 9/28/2009 8:19 pm by neil186288 | 2787 views | 11 replies |

peter383096

Create download button in a Data Assist Results table

Hi,

I have added a row to my DA table and added a download button with a DFP download behavior. everything is working except it unfortunately downloads the most recent field no matter what download button you press. I need some way of linking the button to the id or the file name...

here is a live version here:

loadingDock_List.php
user: guest@fuelcdi.com
pass: fuelgues

PHP Here:
attachment.php?attachmentid=367&stc=1&d=1252455577

Thanks in advance

Attached Files
loadingDock_List.php.zip
Sign in to reply to this post

anonymous

Peter, probably the quickest way to do this would be to actually put the download code inside the loop... but make sure you create some sort of incrementing system.

Like set a variable such as: $incnumber = 0

then inside the loop have it increment like: ++$incnumber

then attach the variable to both the name of your download button and your looped download code, so it would look like this:


<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST["'download'.$incnumber"])){
WA_DFP_DownloadFile("WA_DownloadResult1", "uploads", "".$row_WADAloadingDock['fileName'] ."", "[FileName]", false, false, false, "", "", "", "");
}
?>
<input type="submit" name="download<?php echo $incnumber; ?>" id="download<?php echo $incnumber; ?>" value="Download" />

That way, the file name will populate correctly in the loop and download behavior knows which one to trigger based on the dynamically created unique number you added to each one.

Cheers,

Brian

Sign in to reply to this post

peter383096

Hi Brian,

Thanks so much for your help. I have a couple of questions, please forgive my ignorance.

to define I have used this code directly before my opening HTML code. is that correct?

php:
<?php

//define incnumber variable
$incnumber 0
?>



  then inside the loop have it increment like: ++$incnumber  


This is the bit I am having trouble with, I am not sure where this should be.


Below is my repeating region, is that looking ok?

php:
<?php do { ?>

            <tr class="<?php echo $WARRT_AltClass1->getClass(true); ?>">
              <td class="WADAResultsTableCell"><?php echo $row_WADAloadingDock['submitTime']; ?></td>
              <td class="WADAResultsTableCell"><?php echo($row_WADAloadingDock['fileName']); ?></td>
              <td width="90" align="right" class="WADAResultsTableCell">
              <form id="form1" name="form1" enctype="multipart/form-data" method="post"  action="">
             <?php
                WA_DFP_SetupDownloadStatusStruct
("WA_DownloadResul t1");
                if(isset(
$_POST["'download'.$incnumber"])){
                
WA_DFP_DownloadFile("WA_DownloadResult1""uploads""".$row_WADAloadingDock['fileName'] ."""[FileName]"falsefalsefalse"""""""");
                }
            
?>
            <input type="submit" name="download<?php echo $incnumber?>" id="download<?php echo $incnumber?>" value="Download" />
            </form>
            </td>
            </tr>
          <?php } while ($row_WADAloadingDock mysql_fetch_assoc($WADAloadingDock)); ?>



Once again thanks!
Pete

Sign in to reply to this post

anonymous

That looks right... you would want to add the increment code just after the opening "do" tag like this:


php:
<?php do { ?>

            <?php ++$incnumber?>
            <tr class="<?php echo $WARRT_AltClass1->getClass(true); ?>"> 
              <td class="WADAResultsTableCell"><?php echo $row_WADAloadingDock['submitTime']; ?></td> 
              <td class="WADAResultsTableCell"><?php echo($row_WADAloadingDock['fileName']); ?></td> 
              <td width="90" align="right" class="WADAResultsTableCell"> 
              <form id="form1" name="form1" enctype="multipart/form-data" method="post"  action=""> 
             <?php 
                WA_DFP_SetupDownloadStatusStruct
("WA_DownloadResul t1"); 
                if(isset(
$_POST["'download'.$incnumber"])){ 
                
WA_DFP_DownloadFile("WA_DownloadResult1""uploads""".$row_WADAloadingDock['fileName'] ."""[FileName]"falsefalsefalse""""""""); 
                } 
            
?> 
            <input type="submit" name="download<?php echo $incnumber?>" id="download<?php echo $incnumber?>" value="Download" /> 
            </form> 
            </td> 
            </tr> 
          <?php } while ($row_WADAloadingDock mysql_fetch_assoc($WADAloadingDock)); ?>
Sign in to reply to this post

anonymous

Also, you may have to play with the quotes in the post variable parenthesis, as I am terrible about remembering the exact arrangement when concatenating like that... that's where I go into trial and error mode. :)

Cheers,

Brian

Sign in to reply to this post

peter383096

Hi Brian,

sorry for the lack of reply, i couldn't get this to work so i gave up and just settled for a download in the results page option,

thanks for your help though.

Sign in to reply to this post

anonymous

Sorry to hear that... I may have some time tomorrow, if you still want it to function the way you planned, you could send me the file and I will play around with it.

Sign in to reply to this post

afkrennie381204

Hi SOJO, all,
I also need to get this working and have had no luck. Would really appreciate advice on how to get it to work! I have tried every permutation of S_POST syntax under the sun to no avail - the page displays fine but there's simply no file downloading. I'va also tried this using the unique record id as displayed on the same line (as per the other post on this subject with altered syntax that seems correct too - again, page displays fine but no file downloads). Would really appreciated some advice - many thanks. Ann

For the inc example, code lines are:

<?php
//define incnumber variable
$incnumber=0
?>
// HTML begins here


<?php do { ?>
<?php ++$incnumber; ?>
// repeating table start here


<td class="WADAResultsEntry"><form id="form1" method="post" action="">
<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST['download.$incnumber'])){
WA_DFP_DownloadFile("WA_DownloadResult1", "imageresponse/", "".$row_WADAorders['file_response'] ."", "[FileName]", 1, $database_users, $users, "orders", "idorder", "".$row_WADAorders['idorder'] ."", "download_counter");
}
?>
<input type="submit" name="download<?php echo $incnumber; ?>" id="download<?php echo $incnumber; ?>" value="Download" />

</form

_________________________________________________________________________

and for the example using unique record id, my code is just

<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST["'download'.{$row_WADAorders['idorder']}"])){
WA_DFP_DownloadFile("WA_DownloadResult1", "imageresponse/", "".$row_WADAorders['file_response'] ."", "[FileName]", 1, $database_users, $users, "orders", "idorder", "".$row_WADAorders['idorder'] ."", "download_counter");
}
?>
<input type="submit" name="download<?php echo $row_WADAorders['idorder']; ?>" id="download<?php echo $row_WADAorders['idorder']; ?>"
value="Download" />

//this code is also with the repeating recordset region

Sign in to reply to this post

Jason ByrnesWebAssist

There is a simpler way to go about doing this. See my post to this thread:
showpost.php?p=19527&postcount=11

Sign in to reply to this post

afkrennie381204

works perfectly - thanks a million

Jason - thank you so very much for this. Works perfectly for me. Really grateful for your help this was turning into a headache for me. Have a great day. Ann

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...