0
我需要通過點擊提交按鈕來提交具有特定值的表單。當點擊提交按鈕時,我想要重定向到要求捐款的PayPal。提交捐款後,我需要將客戶重新導向至我的網站,其中提供了有價值的表單並向客戶展示。但現在我堅持下去了。如果我在付款或取消捐贈後按「提交」按鈕,則在我的主要表格中標題和網站上輸入的值沒有任何反應。 我的代碼看起來是這樣的:提交表單內的PayPal捐贈按鈕表單
<form action="adding.php" method="post" enctype='multipart/form-data'>
<table>
<tr>
<td class="abc">
<p id="insert">Title:*</p><br>
<input type="text" name="title" class="abcd" value="<?php echo $title; ?>" />
</td>
<td class="abc">
<p id="insert">Website:*</p><br>
<input type="text" name="website" class="abcd" value="<?php echo $website; ?>" />
</td>
</tr>
</table>
<input type="submit" value="Submit" id="submit" name="submit" />
</form>
<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="EJJ5RT9MEEJSC">
<input type="image" src="http://localhost/www/images/submit.png" id="submit" name="submit" border="0" 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>
<?php
$sql2 = "INSERT INTO `www` (title, website)
VALUES ('$title', '$website')";
?>
<?php
if (isset($_POST['submit'])) {
$con = mysql_connect("localhost","root","");
if (!$con){
exit("Can not connect: " . mysql_error());
}
mysql_select_db("www",$con);
?>
<?php
if ((strlen($title) < 3) or (strlen($title) > 15)) {
echo "<h1 id='top'>Title must be between 3 and 15 characters long!</h1>";
} else if (filter_var($website, FILTER_VALIDATE_URL) === false) {
echo("<h1 id='top'>Website: Please enter a valid website to your wish.</h1>");
}
else
{
mysql_query($sql2,$con);
mysql_close($con);
header("Location:index.php");
}
?>
謝謝你幫我。整個代碼已經在adding.php中。貝寶按鈕,當我點擊圖像時工作。 但自提交形式adds.php確實如果我經過PayPal,則無法工作。 也卸載不爲我工作。 – user3770361
你能否請你試着解釋一下你的想法,指定我應該寫的代碼來完成這項工作。 – user3770361
在頁面上調用上面的JavaScript函數call_paypal()來卸載adding.php,即
– sriharichander