Php 贝宝捐赠按钮表单在提交表单中
我需要通过单击提交按钮提交具有特定值的表单。当点击提交按钮,我想被重定向到贝宝那里要求捐款。在提交捐赠后,我需要将客户重定向回我的网站,在那里,带有值的表单被提交并显示给客户。但现在我被卡住了。如果我在支付或取消捐赠后按“提交”按钮,则在我的主表单中输入的值(标题和网站)不会发生任何变化。 我的代码如下所示:Php 贝宝捐赠按钮表单在提交表单中,php,forms,paypal,Php,Forms,Paypal,我需要通过单击提交按钮提交具有特定值的表单。当点击提交按钮,我想被重定向到贝宝那里要求捐款。在提交捐赠后,我需要将客户重定向回我的网站,在那里,带有值的表单被提交并显示给客户。但现在我被卡住了。如果我在支付或取消捐赠后按“提交”按钮,则在我的主表单中输入的值(标题和网站)不会发生任何变化。 我的代码如下所示: 标题: 首先在adding.php中添加与数据库相关的代码,其中第一个表单提交值,在此表单(adding.php)中,使用javascript提交paypal捐赠表单 i、 e调用页面
标题:
首先在adding.php中添加与数据库相关的代码,其中第一个表单提交值,在此表单(adding.php)中,使用javascript提交paypal捐赠表单
i、 e调用页面卸载上的javascript函数:call_paypal
函数调用_paypal(){document.getElementById(“paypal_frm”).submit();}
完成了…谢谢你帮我。整个代码已经在adding.php中。当我点击图片时,Paypal按钮起作用。但是,如果我通过paypal,self-submitting form adding.php就不起作用。另外,unload对我不起作用。请你试着解释一下你的想法,具体说明我应该编写哪些代码来完成这项工作。在adding.php的unload页调用上面的javascript函数call_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");
}
?>