Need to pass user input from 1 form to another on the same page - forms

I am do not know .php at all but have a problem on one of my websites.
1. There are 2 forms for payment processing on a single page.
2. Each form has a separate submit button.
The problem.
I need to pass some of the user input from form one on to form two.
Note. this is on the same page.
Form 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"/>
Form 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
Custom-str3
from the first form must be transfered into the second form as well
thanks

You should think of using some client-side JavaScript. I'd recommend using jQuery.
Not sure whether you have any experience in JS but that won't be very complex.
Basically, all you have to do is:
1) Read the value of the first input
email = $('#email_address').val()
2) Assign it to the other field (not sure what fields you want to assign)
$('#txtShippingAddress2').val(email)
Then just bind this code to your submit button or anywhere you need it.
You can find out more about jQuery at http://jquery.com/

Related

gtpay payment intergration which giving a hash key error

I have integrated below test php code to integrate gtpay payment in my site.But I am getting following error.
Response Description: Interface Integration Error
It is has key related problem given in the below gtpay integration manual.
https://ibank.gtbank.com/gtpay/IntegrationAPI/mman-tech.html
But I have tried several time to resolve this issue but not getting any solution. Please find the error.
<?php
$the_key = trim('17'.'5664879896'.'200'.'840'.'458742'.'D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F');
$key = hash('sha512',$the_key,false);
?>
<form name="submit2gtpay_form" action="https://ibank.gtbank.com/GTPay/Tranx.aspx" target="_self" method="post">
<!-- <input type="hidden" name="hashkey" value="">-->
<input type="hidden" name="gtpay_mert_id" value="17" />
<input type="hidden" name="gtpay_tranx_id" value="5664879896" />
<input type="hidden" name="gtpay_tranx_amt" value="200" />
<input type="hidden" name="gtpay_tranx_curr" value="840" />
<input type="hidden" name="gtpay_cust_id" value="458742" />
<input type="hidden" name="gtpay_cust_name" value="Test Customer" />
<input type="hidden" name="gtpay_tranx_memo" value="Mobow" />
<input type="hidden" name="gtpay_no_show_gtbank" value="YES" />
<input type="hidden" name="gtpay_echo_data" value="TEST" />
<input type="hidden" name="gtpay_gway_name" value="" />
<input type="hidden" name="gtpay_hash" value="<?php echo trim($key); ?>" />
<input type="hidden" name="gtpay_tranx_noti_url" value="" />
<input type="submit" value="Pay Via GTPay" name="btnSubmit"/>
<input type="hidden" name="gtpay_echo_data" value="">
</form>
You are required to make the hash of [gtpay_mert_id,gtpay_tranx_id,gtpay_tranx_amt,gtpay_tranx_curr,gtpay_cust_id,gtpay_tranx_noti_url,hashkey] (Total 7 params).
You are making the hash key with only 6 params. You missed with the gtpay_tranx_noti_url(gtpay transaction notifying URL).
The gtpay_tranx_noti_url is a required field.
<?php
$the_key = trim('17'.'5664879896'.'200'.'840'.'458742'.'YES'.'D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F');
$key = hash('sha512',$the_key,false);
?>
<form name="submit2gtpay_form" action="https://ibank.gtbank.com/GTPay/Tranx.aspx" target="_self" method="post">
<!-- <input type="hidden" name="hashkey" value="">-->
<input type="hidden" name="gtpay_mert_id" value="17" />
<input type="hidden" name="gtpay_tranx_id" value="5664879899" />
<input type="hidden" name="gtpay_tranx_amt" value="200" />
<input type="hidden" name="gtpay_tranx_curr" value="840" />
<input type="hidden" name="gtpay_cust_id" value="458742" />
<input type="hidden" name="gtpay_cust_name" value="Test Customer" />
<input type="hidden" name="gtpay_tranx_memo" value="Mobow" />
<input type="hidden" name="gtpay_no_show_gtbank" value="YES" />
<input type="hidden" name="gtpay_echo_data" value="TEST" />
<input type="hidden" name="gtpay_gway_name" value="" />
<input type="hidden" name="gtpay_hash" value="<?php echo trim($key); ?>" />
<input type="hidden" name="gtpay_tranx_noti_url" value="" />
<input type="submit" value="Pay Via GTPay" name="btnSubmit"/>
<input type="hidden" name="gtpay_echo_data" value="">
</form>
Its worked if error in gtpay_tranx_id duplicate entry...
Just change any value and reload it.

What may be wrong with my hidden form fields for Paypal custom cart

I have two Carts on a site I am working on. One works just fine. The other though is not, and I can't find the problem at all.
The code for the form is blow (hidden domain name and email of course):
<form id="paypalpayment" action="https://www.paypal.com/cgi-bin/webscr" method="POST">
<input type="hidden" name="order_id" value="24" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="business" value="pay#xxxxxxxx.com" />
<input type="hidden" name="item_name_1" value="Shopping Cart" />
<input type="hidden" name="item_number_1" value="Order-24" />
<input type="hidden" name="amount_1" value="23.49" />
<input type="hidden" name="first_name" value="My" />
<input type="hidden" name="last_name" value="Surname" />
<input type="hidden" name="address1" value="My Street">
<input type="hidden" name="address2" value="My Village">
<input type="hidden" name="city" value="My City">
<input type="hidden" name="zip" value="My Post Code">
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="tax_rate" value="20.00" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="return" value="http://www.xxxxxxxx.co.uk/shop/payments/itempaymentreceived/24" />
<input type="hidden" name="cancel_url" value="http://www.xxxxxxxx.co.uk/shop/payments/paymentcancelled" />
<input type="hidden" name="notify_url" value="http://www.xxxxxxxx.co.uk/shop/payments/itemipn/24" />
<div class="form-group">
<input type="submit" class="btn btn-wide btn-primary" value="Pay Now" id="btnSubmit" name="btnSubmit"/>
</div>
</form>
I know it a case of not seeing the wood for the trees, but any pointer would be gratefully received.
Thanks

ReturnURL opening in iFrame instead of reloading page

I am using Paypal Pros iframe implementation and all is working fine...
<iframe name="hss_iframe" width="570px" height="540px"></iframe>
<form style="display:none;" target="hss_iframe" name="form_iframe" method="post" action="https://securepayments.paypal.com/cgi-bin/acquiringweb?cmd=_hosted-payment">
<input type="hidden" name="cmd" value="_hosted-payment">
<input type="hidden" name="subtotal" value="50.00">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="business" value="KASDFS323234">
<input type="hidden" name="paymentaction" value="sale">
<input type="text" name="custom" value="<?php echo $_REQUEST['email_address']; ?>">
<input type="hidden" name="template" value="templateD">
<input type="hidden" name="notify_url" value="http://www.mydomain.com/notify.php" />
<input type="hidden" name="return" value="http://www.mydomain.com/thankyou">
</form>
My problem is that the return URL of www.mydomain.com/thankyou is opening up inside of the iframe instead of reloading the browser with that page.
Has anyone experienced a similar issue?

PayPal redirect after payment

Hy,
I have a problem with a PayPal redirection after the payment. When the client is redirected to the confirmation page after the payment, in background I save the data into DB and I send an email with the invoice to the merchant and to the client.
For the redirection I user a return parameter with the value like this: http://domain.com/en/shop/shopping-cart/?wpcomethod=cosuccess&type=pp_pro&order_id=''
The order Id is a dynamic value.
But it's not working. And also I cannot put this url in the PayPal account preferences, because I have that dynamic id.
This is my form that is sent to PayPal:
<iframe name="hss_iframe" width="570px" height="550px" style="border:1px solid grey;box-shadow:0px 2px 8px 0.5px;position:relative;left:18%;"></iframe>
<form style="display:none" target="hss_iframe" name="form_iframe" action="https://securepayments.paypal.com/cgi-bin/acquiringweb?cmd=_hosted-payment'" method="post" id="pp-form">
<input type="hidden" value="1" name="upload">
<input type="hidden" name="cmd" value="_hosted-payment">
<input type="hidden" name="redirect_cmd" value="_hosted-payment">
<input type="hidden" value="business email" name="business">
<input type="hidden" value="business email" name="receiver_email">
<input type="hidden" value="templateD" name="template">
<input type="hidden" value="false" name="showHostedThankyouPage">
<input type="hidden" id="lc" value="US" name="lc">
<input type="hidden" id="hLang" value="en" name="lang">
<input type="hidden" value="test" name="item_name_1">
<input type="hidden" value="3341" name="item_number_1">
<input type="hidden" value="1" name="quantity_1">
<input type="hidden" value="1" name="num_cart_items">
<input type="hidden" value="5" name="subtotal">
<input type="hidden" value="1" name="no_note">
<input type="hidden" value="EUR" name="currency_code">
<input type="hidden" value="http://domain.com/en/shop/shopping-cart/?wpcomethod=billing" name="cancel_return">
<input type="hidden" value="http://domain.com/en/shop/shopping-cart/?wpcomethod=cosuccess&type=pp_pro&order_id=1116" name="return">
<input type="hidden" value="CLICK HERE TO COMPLETE YOUR ORDER NOW" name="cbt">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="a%3A4%3A%7Bs%3A8%3A%22order_id%22%3Bs%3A4%3A%221116%22%3Bs%3A6%3A%22buynow%22%3Bs%3A1%3A%22N%22%3Bs%3A4%3A%22user%22%3Bs%3A27%3A%22wpco52ca49f594a4d2.97750046%22%3Bs%3A7%3A%22user_id%22%3Bs%3A1%3A%224%22%3B%7D" name="custom">
<input type="hidden" value="INV1116" name="invoice">
<input type="hidden" value="rtytester#yahoo.com" name="email">
<input type="hidden" value="1565556565" name="night_phone_a">
<input type="hidden" value="Test " name="first_name">
<input type="hidden" value="lesz" name="last_name">
<input type="hidden" value="asdsad 555" name="address1">
<input type="hidden" value="" name="address2">
<input type="hidden" value="asdasd" name="city">
<input type="hidden" value="" name="state">
<input type="hidden" value="454445445" name="zip">
<input type="hidden" value="FR" name="country">
<input type="hidden" value="1" name="ptype">
<input type="hidden" value="1" name="pnr">
<input type="hidden" value="5" name="ptotal">
<input type="hidden" value="0" name="pshipp">
</form>
Any sugestions?

Please return to the payment page and correct the address

i have an problem with integration of paypal sandbox for Australia.
in back end i enabled all tab except billing_phone number. when i click pay now i get following error Please return to the payment page and correct the address. here i am attaching my code. thanks in advance
<iframe name="hss_iframe" width="600px" height="600px" style="margin-top:-5px"></iframe>
<form style="display:none" target="hss_iframe" name="form_iframe" method="post" action="https://securepayments.sandbox.paypal.com/acquiringweb">
<input type="hidden" name="cmd" value="_hosted-payment">
<input type="hidden" name="currency_code" value="AUD">
<input type name="subtotal" value="71">
<input type="hidden" name="business" value="FK4PGWANVUF9C">
<input type="hidden" name="shipping" value="0">
<input type name="paymentaction" value="sale">
<input type="hidden" name="template" value="templateD">
<input type="hidden" name="invoice" value="12345">
<input type="hidden" name="billing_first_name" value="John">
<input type="hidden" name="billing_last_name" value="Due">
<input type="hidden" name="billing_address1" value="5 Cromwell St">
<input type="hidden" name="billing_address2" value="Glen Iris">
<input type="hidden" name="billing_city" value="Glen Iris">
<input type="hidden" name="billing_state" value="VIC">
<input type="hidden" name="billing_zip" value="3146">
<input type="hidden" name="buyer_email" value="mark#bssound.com.au">
<input type="hidden" name="billing_country" value="AU">
<input type name="return" value="https://122.165.58.219/team2/wpp-hosted/receipt_page.html">
</form>
<script type="text/javascript">
document.form_iframe.submit();
</script>
My code wasn't working either, but I didn't have the billing fields which I have now added and it worked.
I didn't have:
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="shipping" value="0">
Hope this helps anyone
I had the same problem. I resolved it by adding the same bunch of fields but without "billing_". In your case it will be:
<input type="hidden" name="first_name" value="John">
<input type="hidden" name="last_name" value="Due">
<input type="hidden" name="address1" value="5 Cromwell St">
<input type="hidden" name="city" value="Glen Iris">
<input type="hidden" name="state" value="VIC">
<input type="hidden" name="zip" value="3146">
<input type="hidden" name="country" value="AU">
I don't know whether it's important or not but I also removed both "billing_address2" and "address2".