[FX.php List] Trying to read back an array

Bob Patin bob at patin.com
Fri Sep 17 07:27:10 MDT 2010


A footnote:

You might ask why I'm trying to read the session vars instead of reading the POST values again; here's why:

I'm going to populate this array more than once. The user can return to this page from 2 different submitting forms, and slowly build up this array. So I have to read in the session vars rather than just displaying the POST vars.


On Sep 17, 2010, at 8:18 AM, Bob Patin wrote:

> Hi guys,
> 
> In my last episode our hero was trying to store input into arrays; he got that far...
> 
> Now he's trying to get this back, and here's the problem:
> 
> I store the POST values here:
> 
> // loop through the recid array and create the product arrays
> if( (strlen($_POST['recid'])>0) && (is_array($_POST['recid']))) {
> 	foreach($_POST['recid'] as $recid) {
> 		$_SESSION['description['.$recid.']'] = $_POST['description'.$recid] ;
> 		$_SESSION['type['.$recid.']'] = $_POST['type'.$recid] ;
> 		$_SESSION['serial['.$recid.']'] = $_POST['serial'.$recid] ;
> 		$_SESSION['problem['.$recid.']'] = $_POST['problem'.$recid] ;
> 		$_SESSION['recid['.$recid.']'] = $recid ;
> 	}
> }
> 
> I can return $recid with no trouble, so I'm fairly certain that all my session vars are getting populated.
> 
> NOW... I want to show these on the same page, and wrote this:
> 
> 	  <?php
> 	  // loop through the recid array and create requests for each item
> 		foreach($_SESSION['recid'] as $recid) {
> 			$status = "Open; pending manufacturer approval";
> 			$description = $_SESSION['description'.$recid];
> 			$problem = $_SESSION['problem'.$recid];
> 			$serial = $_SESSION['serial'.$recid];
> 			echo $recid;
> 	?>
> <<<< TABLE >>>>
> <?php
> }
> ?>
> 
> What am I missing here? My FOREACH doesn't return anything at all, and doesn't loop a single time.
> 
> Thanks,
> 
> 
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> iChat: bobpatin
> FileMaker 9, 10 & 11 Certified Developer
> Member of FileMaker Business Alliance and FileMaker TechNet
> --
> Expert FileMaker Consulting 
> FileMaker Hosting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100917/7c3815c5/attachment-0001.html


More information about the FX.php_List mailing list