Thursday, 15 July 2010

php - What am I doing wrong with my array? -



php - What am I doing wrong with my array? -

i have programme receives info , puts array. reasons can't discern, after hours of pulling hair out, field "groupid" shows having been passed, (on next line) not beingness found. here code:

session_start(); // start session first thing in script // script error reporting error_reporting(e_all); ini_set('display_errors', '1'); echo "what sent: " ; print_r($_get); $groupid = $_get['groupid']; $groupname = $_get['groupname']; $price = $_get['price']; $_session["cart_array"] = array( 0 => array( "groupid" => $groupid, "groupname" => $groupname, "price" => $price ) //array ); //array echo "<br />"; print_r ($_session["cart_array"]);

the output of programme follows: sent:

array ( [newvalue] => 1 [thedata] => groupid=1 [groupname] => urban textures [stylepatterncolor] => rbn txtrs [kitdescription] => [standardputup] => 270 [price] => 1485 [discount] => 1417 [discountnote] => 1 [kit] => true [quantity] => 1 )

notice: undefined index: groupid in /home/acmeco5/public_html/acmecomputingcart/cartupdatersimplified.php on line 10 array ( [0] => array ( [groupid] => [groupname] => urban textures [price] => 1485 ) )

notice groupid shows in $_get having value of 1, on next line undefined.

what doing wrong????

thanks in advance help.

you reading print_r results wrong. notice says

[thedata] => groupid=1

that means there element index thedata, value groupid=1. not, element index groupid, trying use.

php arrays

No comments:

Post a Comment