Click here to Skip to main content
15,937,239 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: AJAX : Retrieve Specific Tag by id & count tag from external html Pin
SamRST14-Aug-08 3:52
SamRST14-Aug-08 3:52 
AnswerRe: AJAX : Retrieve Specific Tag by id & count tag from external html Pin
Shog914-Aug-08 9:41
sitebuilderShog914-Aug-08 9:41 
GeneralRe: AJAX : Retrieve Specific Tag by id & count tag from external html Pin
Lu5ck14-Aug-08 16:29
Lu5ck14-Aug-08 16:29 
QuestionDynamic row adding..... Pin
SamRST14-Aug-08 1:50
SamRST14-Aug-08 1:50 
AnswerRe: Dynamic row adding..... Pin
SomeGuyThatIsMe14-Aug-08 7:16
SomeGuyThatIsMe14-Aug-08 7:16 
GeneralRe: Dynamic row adding..... Pin
SamRST16-Aug-08 19:52
SamRST16-Aug-08 19:52 
GeneralRe: Dynamic row adding..... Pin
SomeGuyThatIsMe18-Aug-08 2:02
SomeGuyThatIsMe18-Aug-08 2:02 
QuestionPHP: Invalid argument supplied for foreach () Pin
William Engberts14-Aug-08 0:06
William Engberts14-Aug-08 0:06 
Hi all,

I am writing a webshop. In the header of the "products" page, I have the following:
<pre>
session_start ();
include "php/init.php";

In the init.php, I fill a numer of session variables with product information like:

if (!isset ($_SESSION['products']))
{
$_SESSION['products'][ 0]['id'] = '1';
$_SESSION['products'][ 0]['name'] = 'Castle Lager';
$_SESSION['products'][ 0]['number'] = 0;
$_SESSION['products'][ 0]['price'] = 1.25;
$_SESSION['products'][ 0]['disp'] = '1,25';
$_SESSION['products'][ 0]['VAT'] = 2;
$_SESSION['products'][ 1]['id'] = '2';
$_SESSION['products'][ 1]['name'] = 'Hunters Dry';
$_SESSION['products'][ 1]['number'] = 0;
$_SESSION['products'][ 1]['price'] = 1.70;
$_SESSION['products'][ 1]['disp'] = '1,70';
$_SESSION['products'][ 1]['VAT'] = 2;
etc...
and in the Products.php page, I use these variabes to fill a product list:

foreach ($_SESSION['products'] as $item)
{
etc....
}
</pre>
The reason that I am filling all the individual items is that I have a PC program that maintains all this information, and automatically generates the init.php file on the server.

My issue is that when I first start the page, everything works just fine. However, when I do a refresh of the page, I get the error message "Invalid argument supplied for foreach". If I test if the $_SESSION['products'] has been set, then it says that is has been set, however, if I test for "is_array ($_SESSION['products'])" then it returns false.

Any ideas on how this can have happened would be greatly appreciated!!!

Regards,
William
AnswerRe: PHP: Invalid argument supplied for foreach () Pin
neilmajithia14-Aug-08 2:44
neilmajithia14-Aug-08 2:44 
GeneralRe: PHP: Invalid argument supplied for foreach () Pin
William Engberts14-Aug-08 3:46
William Engberts14-Aug-08 3:46 
AnswerRe: PHP: Invalid argument supplied for foreach () Pin
Mohammad Dayyan15-Aug-08 11:12
Mohammad Dayyan15-Aug-08 11:12 
QuestionRetrieve Data From Other Website Pin
Hemant Thaker13-Aug-08 18:45
Hemant Thaker13-Aug-08 18:45 
AnswerRe: Retrieve Data From Other Website Pin
Johnny ²13-Aug-08 20:31
Johnny ²13-Aug-08 20:31 
QuestionHow to create a news gadget for Windows Vista Pin
ganesh narayan13-Aug-08 7:40
ganesh narayan13-Aug-08 7:40 
AnswerRe: How to create a news gadget for Windows Vista Pin
Manas Bhardwaj13-Aug-08 8:12
professionalManas Bhardwaj13-Aug-08 8:12 
AnswerRe: How to create a news gadget for Windows Vista Pin
Shog913-Aug-08 8:37
sitebuilderShog913-Aug-08 8:37 
QuestionUploading Quicktime video Pin
salil_k_singh13-Aug-08 6:59
salil_k_singh13-Aug-08 6:59 
AnswerRe: Uploading Quicktime video Pin
Manas Bhardwaj13-Aug-08 8:14
professionalManas Bhardwaj13-Aug-08 8:14 
GeneralRe: Uploading Quicktime video Pin
salil_k_singh15-Aug-08 6:11
salil_k_singh15-Aug-08 6:11 
QuestionVideo over IP Pin
sana1713-Aug-08 2:31
sana1713-Aug-08 2:31 
AnswerRe: Video over IP Pin
SomeGuyThatIsMe13-Aug-08 3:16
SomeGuyThatIsMe13-Aug-08 3:16 
QuestionGridView Paging... Pin
Illegal Operation12-Aug-08 16:00
Illegal Operation12-Aug-08 16:00 
QuestionWhat's the real data type for tab dragged in FF & IE & Opera ? Pin
Mohammad Dayyan12-Aug-08 12:31
Mohammad Dayyan12-Aug-08 12:31 
QuestionIE and HTMLFormElement Pin
00willson12-Aug-08 6:38
00willson12-Aug-08 6:38 
QuestionA Beginner's Question Pin
Xiaoming Qian12-Aug-08 3:07
Xiaoming Qian12-Aug-08 3:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.