当用户单击提交按钮时,我需要在我们的网站上提交分类广告表格。广告的价格取决于广告的字数和投放的周数,因此我的 PayPal 按钮会读取我设置的隐藏“金额”字段。如何让我的表单提交,然后重定向到 PayPal,隐藏的金额变量仍然保持其值?任何其他方法也将受到欢迎。
编辑:好的,我已经制作了自己的 php 脚本,可以将原始表单中的信息通过电子邮件发送给我,我一直在使用我的虚拟主机托管的 cgi 脚本。
现在我给自己发电子邮件就好了,我试图找出当我重定向到它时如何将我的隐藏变量从那里发送到贝宝。这是我现在正在尝试的。
<?php
$to = "info.whatzup@gmail.com" ;
$from = $_REQUEST['email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "Classified Tests";
$fields = array();
$fields{"Name"} = "Name";
$fields{"email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"Address"} = "Street Address";
$fields{"City"} = "City";
$fields{"State"} = "State";
$fields{"Zip"} = "Zip Code";
$fields{"Classification"} = "Classification";
$fields{"Ad-Headline"} = "Headline";
$fields{"Ad-Content"} = "Ad Content";
$fields{"Words"} = "Word Count";
$fields{"Weeks"} = "Weeks to Run";
$fields{"WordCount"} = "Total Words";
$fields{"Rate"} = "Word Rate";
$fields{"GrossAmountDue"} = "Gross Amount";
$fields{"NonProfit"} = "Non Profit Ad?";
$item_name = $_POST['item_name'];
$amount = $_POST['amount'];
$currency_code = $_POST['currency_code'];
$no_shipping = $_POST['item_number'];
$shipping = $_POST['item_number'];
$cmd = $_POST['cmd'];
$bn = $_POST['bn'];
$no_note = $_POST['item_number'];
$lc = $_POST['lc'];
$business = $_POST['business'];
$body = "This Ad has been submitted:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
if($send)
{header( "Location: https://www.paypal.com/cgi-bin/webscr" );}
else
{print "We encountered an error sending your mail, please contact us at info.whatzup@gmail.com"; }
}
}
?>