使用Paypal按钮在表单问题中表单

时间:2018-02-24 00:03:27

标签: php html paypal

我遇到了我创建的测试PayPal按钮的问题,如果将其放在我的contact.php页面上的联系表单中,它将无法正确触发。我知道在已创建的表单中不能存在另一种表单。我使用PHP通过电子邮件提交表单,我使用“php echo htmlspecialchars($ _ SERVER [”PHP_SELF“])”提供一些反馈,一旦提交。我不知道AJAX,我的PHP知识也很初学。如何让PayPal按钮仍然在我的表单中工作并将我的用户转移到Paypal支付页面,同时仍然在网站页面上提供反馈?到目前为止,这是我的代码:

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ?>" method="POST">
                <div class="form-group row">
                  <div class="col-sm-12 col-md-6">
                    <label for="firstname" class="col-form-label">Name</label>
                    <input type="text" class="form-control" name="name" id="name" required>
                  </div>
                  <div class="col-sm-12 col-md-6">
                    <label for="firstname" class="col-form-label">Email</label>
                    <input type="email" class="form-control" name="email" id="email" required>
                  </div>
                </div><!--end form-group row-->
                <div class="form-group row">
                  <div class="col-sm-12 col-md-6">
                    <label for="phone" class="col-form-label">Phone Number</label>
                    <input type="text" class="form-control" name="phone" id="phone" required>
                  </div>
                  <div class="col-sm-12 col-md-6">
                    <label for="address" class="col-form-label">Address</label>
                    <input type="text" class="form-control" name="address" id="address" required>
                  </div>
                </div><!--end-form group row-->
                <div class="form-group row">
                  <div class="col-sm-12 col-md-4">
                    <label for="city" class="col-form-label">City</label>
                    <input type="text" class="form-control" name="city" id="city" required>
                  </div>
                  <div class="col-sm-12 col-md-4">
                    <label for="state" class="col-form-label">State</label>
                    <input type="text" class="form-control" name="state" id="state" required>
                  </div><div class="col-sm-12 col-md-4">
                    <label for="zipcode" class="col-form-label">Zipcode</label>
                    <input type="text" class="form-control" name="zipcode" id="zipcode" required>
                  </div>
                </div><!--end form-group row-->
                <div class="row">
                  <div class="col">
                    <textarea rows="10" class="form-control" id="groceries" name="groceries" placeholder="LIST SPECIFIC ITEMS (eg: Publix brand gallon of milk or Winn Dixie brand eggs)" required></textarea>
                  </div>
                </div>
                <!--Paypal-->
              <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
                <input type="hidden" name="cmd" value="_s-xclick">
                <input type="hidden" name="hosted_button_id" value="5WVQ7ZJD3FDTW">
                <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
              </form>
              <!--End Paypal-->
                <!--<button class="send-btn" type="submit">Order Now!</button> OLD SUBMIT BUTTON-->
              </form>

0 个答案:

没有答案