www.webdeveloper.com
Results 1 to 3 of 3

Thread: One 'onclick' for two events/actions.

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    27

    One 'onclick' for two events/actions.

    Hello all,
    I have an image on my productspage.php that when clicked presents a WinZip.exe file for the user to run or save.
    I also want that same click to send me an email , unknown to the person downloading the file, that tells me "Product X Downloaded"
    I do not need the senders email details!
    I have tried to find a solution though googling but can find nothing.
    I have a php script that sends me such an email when the page is opened but cannot see how to combine this with the download action.
    Code:
    <?php
    $email = $_POST['email'];
    mail( "my@email.co.uk", "product X free package", "product X free package page opened", "From: $email" );
    print "THANK YOU FOR DOWNLOADING</br>";?>
    Can this be done and if so how?
    Thanks,
    Phil

  2. #2
    Join Date
    Dec 2011
    Posts
    87
    Here is what I recommend:

    1. Make link point to another page (saying your download will be starting shortly). This can be done with JS as well.
    2. Top of the page have the mail function
    3. then redirect to the winrar.exe download file using Header

  3. #3
    Join Date
    Apr 2009
    Posts
    27
    Thankyou Hamburglar,
    That put me on the right track to get an aknowledgement of intent to download.
    Pity it requires two clicks instead of one - but it works.
    Thanks again.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles