DamienRoche Posted January 6, 2009 Share Posted January 6, 2009 Not sure if I was specific enough up there. Here's what I want to do: I have an array with some values, let's say..... $arr = array('val1','val2','val3'); I want to first save those arrays to a session..... $_SESSION['arr']= $arr; Then I want to refresh......... header("location:".basename(__FILE__)); Then I want to echo then remove one of the values.... echo $arr[0]." has been processed"; $arr = array_diff($arr, $arr[0]); Then I want to repeat until there are no more arrays... I would greatly appreciate any insight into how I can achieve this or if it is even possible. I'd like to put it into a foreach somehow...so the updated array is echoed each time but still redirected...agh, I'm confused. Quote Link to comment Share on other sites More sharing options...
l_kris06 Posted January 6, 2009 Share Posted January 6, 2009 Heres the code, the second file used here is calles test.php through which we pass the value and u can retrieve that value using GET method. <?php session_start(); $arr = array("one","two"); $_SESSION['arr'] = $arr; //count the number of items in the array; $tot = count($arr); $i = 0; while($i<$tot){ //lets send the array value to the next page for futher manipulation $url = "test.php?arrVal=".$_SESSION['arr'][$i]; header('Location: '.$url); $i++; if($i == $tot){ echo "Completed"; exit; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.