Jump to content

foreach loop and $_SESSION


low-rider

Recommended Posts

do a print_r( $_SESSION ); to see what is in the session.

 

But I expect you have forgotten:

 

session_start() -- http://uk3.php.net/function.session-start

 

monk.e.boy

 

 

session_start() is declared at the very top of my page....

 

this is what i have at the top:

 

<?php

session_start();

$_SESSION["food"] = $food;

 

$fullName=$_GET["fullName"];

$houseNN=$_GET["houseNN"];

$streetName=$_GET["streetName"];

$town=$_GET["town"];

$county=$_GET["county"];

$postCode=$_GET["postCode"];

$country=$_GET["country"];

?>

 

this is where i want to echo array FOOD! and underneath in a table, i have the foreach loop!

 

That's telling you that $_SESSION['food'] is set to nothing. Please show us the code where you set the session variable.

 

Also, if you dump the $_SESSION array with

<?php
echo '<pre>' . print_r($_SESSION,true) . '</pre>';
?>

the output is much more readable.

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.