1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need to capture and save to db when paypal button clicked

Discussion in 'C#' started by MikeLindsey, Nov 6, 2008.

  1. #1
    Hello,
    I have standard Paypal "Add to Cart" buttons.
    I don't have a shopping cart on my site I use
    the Paypal shopping cart.

    I'd like to track when a user clicks on the "Add to Cart"
    and save that info to a database.

    I'm proficient at ASP coding but not sure
    how to handle this.

    I was thinking about sending form fields to another
    asp page, updating the db, then create another
    form in code and submit to paypal.

    I don't know if it's possible to submit a form in
    code on the server.

    Any suggestions are appreciated!
     
    MikeLindsey, Nov 6, 2008 IP
  2. ranabra

    ranabra Peon

    Messages:
    125
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First of all what exactly do you want to save in the DB?
    Also, have a client side script which enables the clicking of the button only once!
     
    ranabra, Nov 6, 2008 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    I would use client-side javascript like this:

    
    <script type="text/javascript">
    var xmlDoc;
    function recordClick(xmlFile)
    {
      xmlDoc.async="false";
      xmlDoc.load(xmlFile);
      return true;
    }
    </script>
    
    Code (markup):
    Then in the onclick event of the button have this:
    onclick="recordClick('addclick.asp');"

    The addclick.asp file would have code that would add the click to the database (assuming that you mean you want to count the amount of clicks to the button).

    I haven't tested this code, it might need fine tuning.

    Problem is I think this code will only work in IE... but other browsers may have a similar feature which can be implemented.

    You could also extend this to count the clicks of multiple buttons or links... e.g:
    onclick="recordClick('addclick.asp?id=3');"
     
    camjohnson95, Nov 6, 2008 IP
  4. dinomflorist

    dinomflorist Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    use ajax or another logic
     
    dinomflorist, Nov 16, 2008 IP