combining PHP code with Paypal HTML code

ajetrumpet

Banned
Local time
Today, 01:07
Joined
Jun 22, 2007
Messages
5,638
hello all,

I have this HTML code that I got from Paypal's website:
PHP:
    <td>
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="9031034">
<table align="center">
<tr><td><div align="center" class="style4">
  <input type="hidden" name="on0" value="Application Versions">
  Application Versions</div></td></tr><tr><td><div align="center">
    <select name="os0">
        <option value="Basic Edition">Basic Edition $95.00
      <option value="Professional Edition">Professional Edition $145.00
        </select>
  </div></td></tr>
</table>
<div align="center"><br>
  <input type="hidden" name="currency_code" value="USD">
  <input type="image" src="images/buybutton.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></div>
    </form>    </td>
As far as I can tell, it's all HTML code. what I want to do is put my logging PHP code on a SUBMIT event of the form. Either that or on the click event of the buy button image. this is my tracking code:
PHP:
<?php

$logfile = "Logs/BuyListen.txt";
$ipaddress = $_SERVER['REMOTE_ADDR'];
$visitorDomain = $_SERVER['REMOTE_HOST'];
$referrer = $_SERVER['HTTP_REFERER'];

// Create log line
$logline = $ipaddress . "|" . $visitorDomain . "|" . date(DATE_COOKIE) . "|" . $referrer . "  ";

// Open the log file in "Append" mode
$handle = @fopen($logfile, "a");
fputs($handle, $logline . "\r\n");
fclose ($handle);

?>
the problem I am having is that when i put the code in right now, it is logging the so-called "clicks" and "submissions" when I access the page itself, before I even click on the image that submits the small form. Can anyone assist me getting this right please? Thanks!
 
AJ
Have asked my PHP man and he suggests you check everything on that page and make sure that you do not have anything that has an automatic post on it. He suspects that any automatic post is refreshing the screen and including this as well. Hope that helps.

David
 
AJ
Have asked my PHP man and he suggests you check everything on that page and make sure that you do not have anything that has an automatic post on it. He suspects that any automatic post is refreshing the screen and including this as well. Hope that helps.

David
david,

can you ask him what he means by "automatic post"? PHP has a $_POST method for submitting forms. I think that is related, but really have no idea. "That logging code I showed you is being run when the page is accessed to record a visit to the page itself. I have that on all my pages. thanks!
 

Users who are viewing this thread

Back
Top Bottom