表单有两个操作:发送电子邮件和重定向到PayPal

时间:2017-06-29 21:45:41

标签: php html forms paypal

我正在处理PayPal表单,该表单在提交时还会发送一封电子邮件,其中包含在输入字段中捕获的信息。 PayPal表单非常适合自己,而且PHP Mail操作也适用于它自己。

但是,我不熟悉PHP,我似乎无法在单击提交按钮时找到运行我的PHP操作和重定向到PayPal链接操作的方法。非常感谢所有帮助。

HTML

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
  <!-- The select element is used by my mail.php -->
  <input name="name" required>
    <select name="priority" size="1" required>
      <option value="Low">Option1</option>
      <option value="Normal">Option 2</option>
      <option value="High">Option 3</option>
    </select>
  <input id="donate-amount" name="donate-amount" type="number" class="center-block donate-form" placeholder="Other Amount"> 
  <input type="hidden" name="cmd" value="_donations" />
  <input type="hidden" name="business" value="email@email.com" />
  <input type="hidden" name="item_name" value="Donation Description">
  <input type="hidden" name="currency_code" value="USD">
  <input type="hidden" name="tax" value="0">
  <input type="hidden" name="lc" value="US">
  <input id="amount" type="hidden" name="amount" value="15.00">

  <input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png" /><span class="lazy_container" style="width: 1px;"><span class="lazy_preloader" style="padding-top: 100%;"></span><img width="1" height="1" alt="" src="plugins/system/tmlazyload/blank.gif" class="lazy" data-src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" /></span>
</form>

PHP

<?php
    $name = $_POST['name'];
    $priority = $_POST['priority'];
    $formcontent=" Donor: $name \n Priority: $priority \n";
    $recipient = "myemail@gmail.com";
    $subject = "Donation";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
?>

0 个答案:

没有答案