提交表单然后用隐藏变量重定向到paypal?

时间:2012-08-14 23:40:59

标签: php javascript forms paypal

当用户点击提交按钮时,我需要在我们的网站上提交分类广告表单。广告的价格取决于单词的数量以及运行的周数,因此PayPal按钮会读取我设置的隐藏“金额”字段。如何让我的表单提交,然后重定向到PayPal,隐藏金额变量仍然保持其值?任何其他方法也将受到欢迎。

编辑: 好的,我已经创建了自己的php脚本,通过我的原始表单将信息发送给我,我一直在使用我的webhost托管的cgi脚本。

现在我给自己发电子邮件很好,我正试图找出当我重定向到它时如何将隐藏变量发送到paypal。继承人我现在正在尝试的事情。

<?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"; } 
 }
}



 ?> 

0 个答案:

没有答案