View Full Version : combining PHP code with Paypal HTML code

10-25-2009, 02:07 AM
hello all,

I have this HTML code that I got from Paypal's website:
<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
<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:

$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!