Hi all,
I've been away from PHP and web developing for the last 7 years. Now I'm designing my own website for my own company.
There will be a 'kind of' payment page. Which will get basic information from a form and redirect the user to a safe payment site.
I've been dying to figure out what I am doing wrong for the past 3 hours. I've asked unlce google every possible question I can think of for the right answer, but, alas, all is left to ask it in a forum, and just sit and hope...
I've got this code :
<?
setlocale( LC_TIME, 'ru_RU.UTF-8', 'russian' );
$thisDay = strftime("%B %Y");
$private_key = "*************************";
$public_key = "i************";
$amount = $_POST["amount"];
$comments = $_POST["comments"];
$results = array(
'version' => 3,
'action' => 'pay',
'public_key' => $public_key,
'amount' => "500", (this works)
'currency' => 'UAH',
'description' => "test", (this works)
'type' => 'buy',
'language' => 'ru'
);
$data = base64_encode(json_encode($results));
$signiture = base64_encode( sha1( $private_key . $data . $private_key, 1 ) );
?>
which then uses this form to pass the data to the site :
<form method="POST" accept-charset="utf-8" action="https://xxxxxxxxxxxxxxxxxxx" />
<input type="hidden" name="data" value="<? echo $data; ?>" />
<input type="hidden" name="signature" value="<? echo $signiture; ?>" />
<input type="text" name="clientNo" style="width:30px;" />
<input type="text" name="clientName" style="width:300px;" />
<input name="amount" type="text" style="width:50px; text-align:center;" />
<input type="text" name="comments" style="width:300px; text-align:center;" />
<input type="image" src="images/payment-01.png" name="btn_text" />
</form>
</div>
this works well but the array I use is just the data I entered myself. I have to get the Amount and Description
But when I change the php code to this it just does not get the data from the form :
<?
setlocale( LC_TIME, 'ru_RU.UTF-8', 'russian' );
$thisDay = strftime("%B %Y");
$private_key = "*************************";
$public_key = "i************";
$amount = $_POST["amount"];
$comments = $_POST["comments"];
$results = array(
'version' => 3,
'action' => 'pay',
'public_key' => $public_key,
'amount' => $amount, (this does not work)
'currency' => 'UAH',
'description' => $comments, (this does not work)
'type' => 'buy',
'language' => 'ru'
);
$data = base64_encode(json_encode($results));
$signiture = base64_encode( sha1( $private_key . $data . $private_key, 1 ) );
?>
I am pretty sure that it is so simple that I look stupid. But.. I can not resolve this problem on my own..
I tried this :
<?
setlocale( LC_TIME, 'ru_RU.UTF-8', 'russian' );
$thisDay = strftime("%B %Y");
$private_key = "*************************";
$public_key = "i************";
if (isset($_POST["amount"])) / (this does not work)
{
$amount = $_POST["amount"];
$comments = $_POST["comments"];
$results = array(
'version' => 3,
'action' => 'pay',
'public_key' => $public_key,
'amount' => $amount, (this does not work)
'currency' => 'UAH',
'description' => $comments, (this does not work)
'type' => 'buy',
'language' => 'ru'
);
$data = base64_encode(json_encode($results));
$signiture = base64_encode( sha1( $private_key . $data . $private_key, 1 ) );
}
?>
Not working...
Please help!
Thanks in advance !!!