1
<?php 
$action=$_REQUEST['action']; 
if ($action=="")   
{ 
?> 

<center>
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="example@example.com">
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="item_name" value="Donation">
<input type="number" name="amount" value="10">
<br>
<input type="image" src="http://www.bgclubfc.org/donate-Now.gif" width="150px"     height="50px" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
</center>


    <?php 
    }  
else                
    { 
    $amount=$_REQUEST['amount']; 
    if (($amount==""))
        { 
        echo "All fields are required, please fill <a href=\"\">the form</a> again."; 
        } 
    else{         
        mail("example@example", "donation", $amount); 
        echo "Email sent!"; 


    } 
    }  
?> 

Okay here is my code. It is a working paypal donation button. But I want to receive and email when ever a donation is made with the amount that was donated. So when they submit the form or click the donate now button I want to receive an email with what the input was.

Thank you

reidjako
  • 384
  • 3
  • 4
  • 17

1 Answers1

0

Your question is very unclear, still from the code what i understand that you are trying to create paypal donate button.

Please check below link useful for that.

https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/donation_buttons/

Rootvik
  • 56
  • 3
  • I noticed It was very unclear and I am going to edit it. I have created a paypal donation button that works find. What I want to do is request the amount donated and send that amount to me as an email. That is the bit I can not do The question has been edited – reidjako Aug 07 '13 at 07:58
  • so is your donation amount is fixed or you want user to set that amount for you? – Rootvik Aug 07 '13 at 08:55
  • You need to provide notify_url to receive all information related to payment. – Rootvik Aug 07 '13 at 09:03
  • They set the donation then click donate. It then takes you to the paypal where you pay. I want the amount to be emailed to me when it is sent. I will then change it from mail(blahbalhbalh) to uploading it to an sql database. Paypal works I just need to request $amount. if that makes sense – reidjako Aug 07 '13 at 09:34
  • You want to get donation amount entered by user with you. But according to your code when user will click on donate button it will redirect to paypal site and will do the payment.U will never find value for $_REQUEST['action'] variable in this file. 1)You have to add notify_url parameter in your code.So when user does payment successfully paypal automatically sends all information to that url. [link]http://stackoverflow.com/questions/2865970/notify-url-of-paypal[link] 2)Before sending to paypal u can store that information to ur database. By calling ajax function before redirecting to paypal. – Rootvik Aug 12 '13 at 14:30