Hi all,
I'm super super new to php and am looking for a little help in regards to a php program a friend has purchased and wants modified.
I can't figure out how to pass the amount values to the pay.php file, which is then passed on to the payment type file (ie: Alertpay or Bank Transfer)...??
This is the form:
<form method="POST" action="pay.php">
Amount:
<select size="1">
<option name="payamount" value="single">${egold_amount}</option>
<option name="payamount" value="multiple">${egold_amount_multi}</option>
</select><br />
Payment through : <select size="1" name="p">
<option value="3">AlertPay</option>
<option value="4">SafePay</option>
<option value="1">Bank Transfer</option>
</select> <input type="submit" value=" Do Payment " name="B1"></p>
</form>
This is the pay.php file:
<?php
require_once("../config_inc.php");
require_once("../includes/globals_inc.php");
require_once("../includes/member_login_inc.php");
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
header('Last-Modified: ' . gmdate('D, d M Y H:i:s' ) . ' GMT' );
header('Cache-Control: no-store, no-cache, must-revalidate' );
header('Cache-Control: post-check=0, pre-check=0', false );
header('Pragma: no-cache' );
if ($_SESSION['userlevel'] == 1) display_html(_ACCOUNT_IS_ACTIVE, "msg.html");
$http_host = $_SERVER["HTTP_HOST"];
$payment_id = make_sid();
mysql_query("UPDATE members SET payment_id='$payment_id' WHERE userid='{$_SESSION['userid']}'");
$payto = $_REQUEST['p'];
switch($payto) {
case '1' :
include "../payments/pay_bank.php";
break;
case '2' :
include "../payments/pay_egold.php";
break;
case '3' :
include "../payments/pay_alertpay.php";
break;
case '4' :
include "../payments/pay_safepay.php";
break;
default :
display_member_page("member_upgrade.html", $show_array);
}
?>
This is the pay_alert.php file:
<?php
//Please edit here :
$Payment_Amount = $_SESSION['conf_egold_amount']; // Payment amount (change if you need )
$PayTo_Account = "myusername@mydomain.com"; // Your alertpay email
//Stop edit
defined( '_VALID_MOS_' ) or die( 'Restricted Access' );
echo <<<EOF
<html>
<head>
<title>{$_SESSION['conf_program_name']}</title>
<script language="JavaScript">
function submitform()
{
formObj = document.spendfrm;
formObj.submit();
}
</script>
</head>
<body>
<form name="spendfrm" action="https://www.alertpay.com/PayProcess.aspx" method="post">
<input type="hidden" name="ap_purchasetype" value="Item">
<input type="hidden" name="ap_merchant" value="$PayTo_Account">
<input type="hidden" name="ap_itemname" value="{$_SESSION['conf_program_name']} membership">
<input type="hidden" name="ap_currency" value="USD">
<input type="hidden" name="ap_returnurl" value="http://$http_host/members/done.php?id={$_SESSION['userid']}">
<input type="hidden" name="ap_quantity" value="1">
<input type="hidden" name="ap_description" value="1 year membership">
<input type="hidden" name="ap_amount" value="$Payment_Amount">
<input type="hidden" name="ap_cancelurl" value="http://$http_host/members/index.php">
<input type="hidden" name="apc_1" value="{$_SESSION['userid']}">
<input type="hidden" name="apc_2" value="$payment_id">
<p align="center">Click the button if your browser did not brought you to AlertPay payment page. <br> <br>
<input type="submit" name="PAYMENT_METHOD" value="Process Payment"> </p>
</form>
<script language="javascript">
alert("You will now brought to third party AlertPay payment.")
submitform();
</SCRIPT>
</body>
</html>
EOF;
exit;
?>
I need the $Payment_Amount to change according to the option selected in the form:
ie: "single" = $Payment_Amount = $SESSION['conf_egold_amount'];
or "multiple" = $Payment_Amount = $SESSION['conf_egold_amount_multi'];
Like I said, super super noob....I don't even know if I've framed my question well :o I hope I don't sound like an idiot!