I have an order form that has several text areas and one PayPal Buy Now button. I would like the PayPal button to work as usual, sending the order to PayPal, but I would also like the same button to collect data in the form and send it by email. For this, however, the button will have to have two actions: sending data to PayPal and sending data back to my php page.
This seems to be a common problem, without a clear solution, but using only PHP. Since I only need data from the forms, I thought I could capture this with Javascript. I thought I could put the onClick event on the paypal button, which would call a JavaScript function that contains the PHP needed to send the email.
Is it possible? Can I change my mind about this?
EDIT
Okay, so I donβt want to delve into the PayPal API, since I donβt like it with PayPal. I am thinking of another solution that has not yet worked, but it may have potential.
The standard PayPal button code uses the input type = "image" for the button. I put a link element around this input tag and reference the javascript function. For instance:
<a href="javascript: submitForm()"> <input type="image src= ...> </a>
I have a form configured like this:
<form name="userInfo" action="sameFile.php" method="post">
"sameFile.php" - php, .
:
<script type="text/javascript"> function submitForm(){ document.forms["userInfo"].submit();}</script>
userInfo - . , "userInfo" , PayPal, ...
, , , PayPal . php.
PHP , POST. -, POST, . ? PHP, ?