2011-12-29 138 views
1

我知道這是非常基本的,但我正在爲我的網站編輯wordpress插件,我想知道如何將用戶發送到thankyou.php頁面place_order 按鈕。我試圖將input的值更改爲thankyou.php,但這並不奏效。如何在點擊輸入按鈕時加載新頁面

在此先感謝,這裏是我的PHP文件。 (輸入位於代碼的底部)

<?php 
/** 
* Pay for order form template 
* 
* DISCLAIMER 
* 
* Do not edit or add directly to this file if you wish to upgrade Jigoshop to newer 
* versions in the future. If you wish to customise Jigoshop core for your needs, 
* please use our GitHub repository to publish essential changes for consideration. 
* 
* @package Jigoshop 
* @category Checkout 
* @author  Jigowatt 
* @copyright Copyright (c) 2011 Jigowatt Ltd. 
* @license http://jigoshop.com/license/commercial-edition 
*/ 
?> 

<?php global $order; ?> 
<form id="order_review" method="post"> 

    <table class="shop_table"> 
     <thead> 
      <tr> 
       <th><?php _e('Product', 'jigoshop'); ?></th> 
       <th><?php _e('Qty', 'jigoshop'); ?></th> 
       <th><?php _e('Totals', 'jigoshop'); ?></th> 
      </tr> 
     </thead> 
     <tfoot> 
      <tr> 
       <td colspan="2"><?php _e('Subtotal', 'jigoshop'); ?></td> 
       <td><?php echo $order->get_subtotal_to_display(); ?></td> 
      </tr> 
      <?php if ($order->order_shipping>0) : ?><tr> 
       <td colspan="2"><?php _e('Shipping', 'jigoshop'); ?></td> 
       <td><?php echo $order->get_shipping_to_display(); ?></small></td> 
      </tr><?php endif; ?> 
      <?php if ($order->get_total_tax()>0) : ?><tr> 
       <td colspan="2"><?php _e('Tax', 'jigoshop'); ?></td> 
       <td><?php echo jigoshop_price($order->get_total_tax()); ?></td> 
      </tr><?php endif; ?> 
      <?php if ($order->order_discount>0) : ?><tr class="discount"> 
       <td colspan="2"><?php _e('Discount', 'jigoshop'); ?></td> 
       <td>-<?php echo jigoshop_price($order->order_discount); ?></td> 
      </tr><?php endif; ?> 
      <tr> 
       <td colspan="2"><strong><?php _e('Grand Total', 'jigoshop'); ?></strong></td> 
       <td><strong><?php echo jigoshop_price($order->order_total); ?></strong></td> 
      </tr> 
     </tfoot> 
     <tbody> 
      <?php 
      if (sizeof($order->items)>0) : 
       foreach ($order->items as $item) : 
        echo ' 
         <tr> 
          <td>'.$item['name'].'</td> 
          <td>'.$item['qty'].'</td> 
          <td>'.jigoshop_price($item['cost']*$item['qty']).'</td> 
         </tr>'; 
       endforeach; 
      endif; 
      ?> 
     </tbody> 
    </table> 

    <div id="payment"> 

     <div class="form-row"> 
      <?php jigoshop::nonce_field('pay')?> 
      <input type="submit" class="button-alt" name="pay" id="place_order" value="<?php _e('Pay for order', 'jigoshop'); ?>" /> 

     </div> 

    </div> 

</form> 

回答

4

您沒有指定表單的操作。該操作是通過發送表單收集的數據進行處理的文件。下面的代碼行:

<form id="order_review" method="post"> 

應該是:

<form id="order_review" method="post" action="tankyou.php"> 
+0

你打我吧+1 – vdbuilder 2011-12-29 07:20:15

+0

@AlfredoCastañedaGarcía我試過但沒有成功。還有什麼我需要做的嗎?我很新的PHP :( – novicePrgrmr 2011-12-29 07:21:24

+0

當你點擊提交按鈕時會發生什麼? – 2011-12-29 07:22:58

0

你可以使用重定向

// This will NOT work, the browser received the HTML tag before the script 
header('Location: http://www.yoursite.com/thankyou.php'); 

或通過元標記

<meta http-equiv="refresh" content="0;url= http://www.yoursite.com/thankyou.php"> 

可以取代0以上的增加重定向等待時間

相關問題