Page 1 of 1

Passing Data Problem

Posted: Thu Nov 10, 2005 3:41 pm
by will83
Hi, I hope you can help:

I am creating an online booking system, passing the data from each screen using $_POST and storing them as hidden input values.

page1.php records the amount of people required for booking.

page2.php records the names and ages of each person, using a loop to create the correct amount of name spaces according to the amount entered on previous page. The loop creates the name = "name1" for the first entry and "name2" for the second and so on so that they stay uunique.

page3.php POST the variables og the users name+age from the previous page and this is where i'm have the problem.

I need to carry the names and ages onto yet another page so I need to store them as a hidden input value.


I thought I could create a loop to repeat the same amount of times as there are entries and somehow define the numbers on each of the names : (name1, name2, etc)

Code: Select all

$group = 6; 
	$i=0;
	
	while ($i < $group) {
	$i++;
	echo "<input type=\"hidden\" name=\"name[b]"."$i"."[/b]\" value=\"name"."$i"."\">\n";
	}
I know that this is quite wrong but I just wanted to show what I'm trying to get.

Maybe I have gone the wrong way about it. Maybe I need something that will create an array?

But not sure how, any help would be great

Will

Posted: Thu Nov 10, 2005 3:56 pm
by feyd
why not store the data into a set of session variables?

Posted: Thu Nov 10, 2005 4:10 pm
by will83
Ok thanks for that

Posted: Thu Nov 10, 2005 5:05 pm
by will83
Ok thats good for storing the variables so I dont have to keep posting them across the pages but I still have the problem of storing the entries that my php code generates and then re-calling them.

Any ides to do this?

Thanks

Will

Posted: Thu Nov 10, 2005 6:42 pm
by feyd
why wouldn't sessions provide for that too?