Thank you for your reply,
I have a shopping cart in the first page and the second page is a result page that activate after the user finish paying.
What I want to achieve is create am excel file in the second page that contains the order details.
So lets say the user bought an apple and an orange, what I want to do is add the apple details to the first line of excel file and the orange details to the second line.
I am not sure how to pass the two (orange and apple) details separately to the second page, so what I am doing is:
Code: Select all
foreach ($_SESSION["cart_array"] as $each_item)
{
$myArr = array("Vijay","Joshi","Vikaspuri", "Delhi",27); $excel->writeLine($myArr);
}
Since their are 2 products (apple and orange in my array), the $myarr will create an apple line and an orange line in my excel file, but I want to create the excel file in my second page after the user pay.
So I am passing this line $myArr = array("Vijay","Joshi","Vikaspuri", "Delhi",27); $excel->writeLine($myArr); inside a variable called $myVariable to the second page and use the content inside it.
I thought about getting the session and get the info from them, but I got into a problem, which is if the user add products to the basket and then visit another page and click buy a different product, this way I will have different details of a different item inside the session.
heheh I know this is stupid way to use, I am new to php and this is a practice website where I am learning php from, I will be soooo soooo happy if their are a better way.
I know I am trying to learn and it is hard and complicated but in the same time I am finding php so fun to code and use.