vassili Posted February 13, 2008 Share Posted February 13, 2008 in show.php i have this... $cartSizes = isset($_SESSION['cartSizes']) ? $_SESSION['cartSizes'] : array(); $maxSizes = 8; $productid = $_GET['id']; $cartSizes[$productid] = array(); for( $i=1;$i<$maxSizes; $i++ ){ $cartSizes[$productid][$i] += $_POST['qty'.$i]; } $_SESSION['cartSizes'] = $cartSizes; so now array $cartSizes should be saved in session. now i want to place the value of $cartSizes[$productid][$i] into an input text field in another file called function.php. we'll say $i=1 so i want the value in $cartSizes[$productid][1] i need to place the value in this line of function.php $output[] = '<input type="hidden" name="qty'.$id.'" value="[b]I HAVE NO IDEA[/b]" size="3" maxlength="3" />'; thanks. Link to comment https://forums.phpfreaks.com/topic/90960-results-from-an-array-saved-in-session/ Share on other sites More sharing options...
rhodesa Posted February 13, 2008 Share Posted February 13, 2008 $output[] = '<input type="hidden" name="qty'.$id.'" value="'.htmlspecialchars($_SESSION[$id][1]).'" size="3" maxlength="3" />'; Link to comment https://forums.phpfreaks.com/topic/90960-results-from-an-array-saved-in-session/#findComment-466185 Share on other sites More sharing options...
vassili Posted February 13, 2008 Author Share Posted February 13, 2008 $output[] = '<input type="hidden" name="qty'.$id.'" value="'.htmlspecialchars($_SESSION[$id][1]).'" size="3" maxlength="3" />'; yeah, after trial and error, this works too. value=" '.$_SESSION['cartSizes'][$id][1].' " Link to comment https://forums.phpfreaks.com/topic/90960-results-from-an-array-saved-in-session/#findComment-466194 Share on other sites More sharing options...
rhodesa Posted February 13, 2008 Share Posted February 13, 2008 oh yeah...forgot 'cartSizes'...you got the idea though Link to comment https://forums.phpfreaks.com/topic/90960-results-from-an-array-saved-in-session/#findComment-466210 Share on other sites More sharing options...
vassili Posted February 13, 2008 Author Share Posted February 13, 2008 oh yeah...forgot 'cartSizes'...you got the idea though thanks for the help man Link to comment https://forums.phpfreaks.com/topic/90960-results-from-an-array-saved-in-session/#findComment-466221 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.