I need to get the elements and values from an array that is coming via session from another page.
So this is page one
if (!$error) {
session_start();
$user_info = array
(
'fullName' => $fullName,
'street_address' => $street_address,
'city' => $city,
'state' => $state,
'zip' => $zip,
'country' => $country,
'email' => $email,
'phone' => $phone,
'planName' => $planName,
'planPrice' => $planPrice
);
$_SESSION['user_info'] = $user_info;
header("Location:?pid=18&pmh=3");
}
And this is page two that I need to get the values here
<?php
var_dump($_SESSION['user_info']);
$proDetails = array(
"proName"=>"this is the pro name"
);
require_once 'payment-api/Twocheckout.php';
Twocheckout::privateKey('4D67BA12-CE09-4F1D-AB20-0133F24E3472');
Twocheckout::sellerId('901249656');
Twocheckout::sandbox(true);
try {
$charge = Twocheckout_Charge::auth(array(
"merchantOrderId" => "123",
"token" => $_POST['token'],
"currency" => 'USD',
"total" => '10.00',
"billingAddr" => array(
"name" => $_SESSION["user-info"]["fullName"],
"addrLine1" => '123 Test St',
"city" => 'Columbus',
"state" => 'OH',
"zipCode" => '43123',
"country" => 'USA',
"email" => 'example@2co.com',
"phoneNumber" => '555-555-5555'
)
));
if ($charge['response']['responseCode'] == 'APPROVED') {
echo "Thanks for your Order!";
echo "<h3>Return Parameters:</h3>";
echo "<pre>";
echo "His name" . $charge['response']['billingAddr']['name'];
var_dump( $charge );
echo "<br />";
echo $proDetails['proName'];
echo "</pre>";
}
} catch (Twocheckout_Error $e) {
print_r($e->getMessage());
}
now as you can see I need to replace the 'Testing Tester'
with my value coming from session.
I try to do so "name" => $_SESSION["fullName"],
but it didn't work.
and this is the var_dump of var_dump($_SESSION['user_info']);
is
array(8) { ["fullName"]=> string(6) "Yousef" ["street_address"]=> string(11) "this is ass" ["city"]=> string(5) "Cairo" ["state"]=> string(8) "Bassteen" ["zip"]=> string(7) "2125454" ["country"]=> string(3) "EGY" ["email"]=> string(21) "johnef_sh@hotmail.com" ["phone"]=> string(11) "01224853582" } Thanks for your Order!