$cartcontents = 0 ; // if value of $cartcontents is defined , it will announce undefined $cartcontents
$i = 1 ; while ( $i <= $_SESSION["productlist"] ) ( $cartcontents = "$cartcontents".$_SESSION["cart_m$i"].""; // this is my correction //$cartcontents = "$cartcontents$_SESSION[\"cart_m$i\"]"; $i = $i + 1 ; } This is my result : header(" location : www.2checkout.com/cgibin/sbuyers/cart_order_id=0flower01fruit01cake01 Thanks for your help , thanks so much . "C-Omputersolutions Webmaster" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > the main problem is that each time it your script cycles through the > different ids, it resets the header location to the last value received, the > echo statement just prints each line as it comes up changed keeping the > values you want to show, but the header reference changes every time you > continue the loop and increment $i [see my comments in your script], there > are a few ways you can handle this - you can use a MySQL database [if you > have access to it] to store the variables after each pass, or you can use a > third variable and add to it each time the loop goes through > > <<EXAMPLE>> > $i = 1 ; > while ( $i <= $_SESSION["productlist"] ) > ( > $cartcontents = "$cartcontents$_SESSION[\"cart_m$i\"]"; > $i = $i + 1 ; > } > header(" location : > www.2checkout.com/cgibin/sbuyers/cart_order_id=".$cartcontents"."); > > or a variation on that that suits your situation > <</EXAMPLE>> > -----Original Message----- > From: Lawrence [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 11:02 AM > To: [EMAIL PROTECTED] > Subject: [PHP-WIN] Please help ! > > > // $_SESSION["cart_m"] includes these values : flower01 fruit01 cake01 > > When I echo $_SESSION["cart_m"] , it look like this > $i = 1 ; > while ( $i <= $_SESSION["productlist"] ) > ( > echo $_SESSION["cart_m$i"] ; > <<[EMAIL PROTECTED] - COMMENT - this line works fine because > each echo statement is printed to the same page >> > $i = $i + 1 ; > } > Result is : > flower01 > fruit01 > cake01 > > I want to use these values with 2checkout > $i = 1 ; > while ( $i <= $_SESSION["productlist"] ) > ( > header(" location : > www.2checkout.com/cgibin/sbuyers/cart_order_id=".$_SESSION["cart_m$i"]."") > $i = $i + 1 ; > <<[EMAIL PROTECTED] COMMENT - Here, every time $i is > incremented, the value of header(" location: ...) is changed as well > therefore with each pass the header variable will equal the corresponding > cart_m$i data (ie cart_m$1 = flower01, cart_m$2 = fruit01, cart_m$3 = > cake01) which is why the only result you get is the cart_order_id=cake01>> > } > > But result is I just receive the last result : > www.2checkout.com/cgibin/sbuyers/cart_order_id=cake01 > > I want to get all values like this , but I do not know how to do , anyone > can help me , thank you . > www.2checkout.com/cgibin/sbuyers/cart_order_id=cake01fruit01flower01 > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php