1
我試圖讓它到達用戶/客戶點擊結帳按鈕的位置。它會通過我的「checkout.php」將信息提交給我的電子郵件,但也會將它們重定向到我的PayPal結帳。貝寶是奇怪的,並使用我不明白的令牌系統。鏈接發生變化,所以我不能將它們重定向到靜態鏈接。請幫助提交表單並重定向到一個PHP和一個鏈接
PayPal按鈕
<form action="https://www.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="K3GEAYAPBYY54">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
表
<form name="purchase" onsubmit="return validateForm()" action="php/checkout.php" method="POST">
<div class="form-style-8">
<label for="msg">E-mail:</label>
<input type="email" id="mail" name="email" placeholder="[email protected]" />
</div>
<div>
<label for="msg">Username:</label>
<br>
<input id="user" name="username" placeholder=" Username">
</div>
<div>
<label for="msg">Password:</label>
<br>
<input type="password" id="pass" name="password" placeholder=" Password">
</div>
\t \t \t <div>
<input id="submit" type="submit" name="submit" value="submit">
</div>
PHP
<?php
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$to = "[email protected]";
$subject = "$username Info";
$message = "Email: $email <br> Username: $username <br> Password: $password";
$header = "From: [email protected] \r\n";
$header .= "Cc: [email protected]\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
if($retval == true) {
echo "Message sent successfully...";
}else {
echo "Message could not be sent...";
}
?>
<script type="text/javascript">location.href = 'https://www.paypal.com/webapps/hermes?token=82N97270MX287331F&useraction=commit&xclick_params=JTI2aG9zdGVkX2J1dHRvbl9pZCUzREFRVFhVUDNUUlhYV1UlMjZidXNpbmVzcyUzRFU5N1NGU0g1QTRIQUolMjZpdGVtX25hbWUlM0RJbnN0YUxpa2VzQVBJJTI1MjAxJTI1MjBEYXklMjUyMFRva2VuJTI2aXRlbV9udW1iZXIlM0QwMDAxJTI2YW1vdW50JTNEMC43NCUyNmN1cnJlbmN5X2NvZGUlM0RVU0QlMjZsYyUzRFVTJTI2YnV0dG9uX3N1YnR5cGUlM0RzZXJ2aWNlcyUyNm5vX25vdGUlM0QwJTI2Y24lM0RBZGQlMjUyMHNwZWNpYWwlMjUyMGluc3RydWN0aW9ucyUyNTIwdG8lMjUyMHRoZSUyNTIwc2VsbGVyJTI1M2ElMjZub19zaGlwcGluZyUzRDIlMjZ0Y#/checkout/login';</script>
//OLD LINK
舊的鏈接是現在老了,除非生成一個新的鏈接將不會加載並投入了PHP。我該如何解決這個問題?
我不知道,貝寶可以讓您控制的鏈接,這將用戶重定向至。 –
而不是用'location.href'返回JS,用JS代碼返回'Paypal按鈕'表單,它會提交這個表單。您可以移除圖像按鈕以使該表單完全不可見,但仍可從JS提交。 – djxak
我不知道如何編寫JS的代碼?幫幫我? –