Send array from php to php

Send array from php to php

am 19.01.2008 10:58:10 von sahm

HI every one
I' try to send array from web page to php file
but no data are show
I'm using session to store data
and this is my code
//////////////////////////////////////////////////////////// ////////////
$data = $cart_items;
session_register('data');
foreach ($cart_items as $cart_item) {
echo "";
echo " ".$cart_item->name."";
echo " ".$cart_item->description." span>";
echo " ".$cart_item->price." S.R. td>";
echo " ".$cart_item->quantity." td>";
echo " ".$cart_item->price * $cart_item-
>quantity."
";
echo " [del]";
echo "";
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\
\

and this is my php code to get the data
////////////////////////////////////////////////////////
foreach ($data as $item)
{
echo "";
print " ".$item->name."";
echo " ".$item->description."";
echo " ".$item->price." $";
echo " ".$item->quantity."";
echo " ".$item->price * $cart_item-
>quantity."
";
echo "";
}
?>

\\\\\\\\\\\

whene this code is runing
it create table white correct number of row but no data is show
can any one help me white this
I will be thankful
Salim

Re: Send array from php to php

am 19.01.2008 11:52:46 von Michael Fesser

..oO(sahm)

>I' try to send array from web page to php file
>but no data are show
>I'm using session to store data
>and this is my code
>/////////////////////////////////////////////////////////// /////////////

Call session_start() at the beginning of each(!) page.

>$data = $cart_items;
> session_register('data');

session_register() is deprecated. Simply use the $_SESSION array
instead:

$_SESSION['data'] = $cart_items;

>and this is my php code to get the data
>////////////////////////////////////////////////////////

session_start();

> >foreach ($data as $item)

foreach ($_SESSION['data'] as $item) {
...
}

Also check your error_reporting directive in your php.ini (set it to
E_ALL|E_STRICT) and register_globals (should be off).

Micha