2012-04-05 5 views
0

Ich weiß nicht, .php überhaupt, aber ein Problem auf einer meiner Websites. 1. Es gibt 2 Formulare für die Zahlungsverarbeitung auf einer einzelnen Seite. 2. Jedes Formular verfügt über eine separate Senden-Schaltfläche.Notwendigkeit, Benutzereingabe von 1 Formular zu einem anderen auf der gleichen Seite zu übergeben

Das Problem. Ich muss einen Teil der Benutzereingabe von Formular eins an Formular zwei weitergeben. Hinweis. Dies ist auf der gleichen Seite.

Formular 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"/> 

Formular 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 Sonderanfertigungen str3 von der ersten Form muss in das sec übertragen werden ond bilden auch

dank

Antwort

0

Sie denken sollten einige clientseitige JavaScript verwenden. Ich würde empfehlen, jQuery zu verwenden.

Nicht sicher, ob Sie irgendwelche Erfahrung in JS haben, aber das wird nicht sehr komplex sein.

Grundsätzlich alles, was Sie tun müssen, ist:

1) Weisen Sie den Wert des ersten Eingangs Lesen

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

2) es auf dem anderen Feld (nicht sicher, welche Felder Sie zuweisen möchten)

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

Dann binden Sie einfach diesen Code an Ihre Schaltfläche senden oder wo immer Sie es brauchen.

Sie können mehr über jQuery unter http://jquery.com/

erfahren
Verwandte Themen