2012-04-05 81 views
0

我根本不知道.php,但在我的某個網站上有問題。 1.在單頁上有兩種付款處理形式。 2.每個表單都有一個單獨的提交按鈕。需要將用戶輸入從1個窗體傳遞到另一個窗體

問題所在。 我需要傳遞一些來自表單一的用戶輸入以形成兩個。 注意。這是在同一頁上。

表1

<input type="hidden" name="payfast_url" id="payfast_url" value="https://www."/> 
    <input type="hidden" name="merchant_id" id="merchant_id" value="xxxxx"/> 
    <input type="hidden" name="merchant_key" id="merchant_key" value="xxxxx"/> 
    <input type="hidden" name="return_url" id="return_url" value="payment_finished.html"/> 
    <input type="hidden" name="cancel_url" id="cancel_url" value="payment_cancelled.html"/> 
    <input type="hidden" name="notify_url" id="notify_url" value="/payment_notify.html"/> 
    <input type="hidden" name="item_name" id="item_name" value="Product name"/> 
    <input type="hidden" name="item_description" id="item_description"value="description"/> 
    <input type="hidden" name="email_confirmation" id="email_confirmation" value="1"/> 
    <input type="hidden" name="confirmation_address" id="confirmation_address" value=""/> 
    <input type="hidden" name="amount" id="amount" value="price" /> 
    <input type="hidden" name="payment_id" id="payment_id" value="website_sales" /> 
    <span class="formlable">Name</span><input name="name_first" id="name_first"type="text" value="" class="forminput"/> 
    <span class="formlable">Surname</span> <input name="name_last" id="name_last" type="text" value="" class="forminput"/> 
    <span class="formlable">E-Mail</span> <input type="text" name="email_address" id="email_address" value="" class="forminput"/> 
    <span class="formlable">Post Address</span> <input name="custom_str1" id="custom_str1" type="text" value="" class="forminput"/> 
    <span class="formlable">City</span><input name="custom_str2" id="custom_str2" type="text" value="" class="forminput"/> 
    <span class="formlable">Postal Code</span><input name="custom_str3" id="custom_str3" type="text" value="" class="forminput"/> 
<input type="button" value="EFT Payment" onclick="quickPostPaymentToPayFast(document.getElementById('payfast_url').value);" id="button" method="post"/> 

表2

<form name="CreditCards" action="https://www.mygate.co.za/.cfm" method="post"/> 
<input type="hidden" name="Mode" id="Mode" value="0"/> 
<input type="hidden" name="txtMerchantID" id="txtMerchant" value="xxxxxxx"/> 
<input type="hidden" name="txtApplicationID" id="txtApplicationID" value="xxxxxxxx"/> 
<input type="hidden" name="txtMerchantReference" id="txtMerchantReference" value="1234"/> 
<input type="hidden" name="txtPrice" id="txtPrice" value="1234"/> 
<input type="hidden" name="txtCurrencyCode" id="txtCurrencyCode" value="ZAR"/> 
<input name="txtRedirectSuccessfulURL" value="success_failure.php" readonly="true" type="hidden"/> 
<input name="txtRedirectFailedURL" value="success_failure.php" readonly="true" type="hidden"/ >   
<input type="hidden" name="txtQty" id="txtQty" value="1"/> 
<input type="hidden" name="txtItemDescr" id="txtItemDescr" value="descr"/> 
<input type="hidden" name="txtItemAmount" id="txtItemAmount" value="449.00"/> 
<input type="hidden" name="txtRecipient"   value="<?php $_POST["name_first"]; ?>"/> 
<input type="hidden" name="txtShippingAddress1" value="<?php $_POST["name_last"]; ?>"/> 
<input type="hidden" name="txtShippingAddress2" value="<?php $_POST["email_address"]; ?>"/> 
<input type="hidden" name="txtShippingAddress3" value="<?php $_POST["custom_str1"]; ?>"/> 
<input type="hidden" name="txtShippingAddress4" value="<?php $_POST["custom_str2"]; ?>"/> 
<input type="hidden" name="txtShippingAddress5" value="<?php $_POST["custom_str3"] ?>"/> 
<input type="submit" id="button4" value="Credit card" /> 
</form> 

name_first name_last EMAIL_ADDRESS custom_str1 custom_str2 定製STR3 從第一表格必須被轉移到SEC ond form

謝謝

回答

0

您應該考慮使用某些客戶端JavaScript。我建議使用jQuery。

不確定你是否有任何JS經驗,但這不會很複雜。

基本上,所有你需要做的是:

1)閱讀第一輸入

email = $('#email_address').val()

2的值),將其分配到其他領域(不知道你要分配哪些字段)

$('#txtShippingAddress2').val(email)

然後只需將此代碼綁定到您的提交按鈕或任何您需要它的地方。

你可以在http://jquery.com/找到更多關於jQuery的信息

相關問題