Passing Data Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
will83
Forum Commoner
Posts: 53
Joined: Thu Nov 10, 2005 3:13 pm

Passing Data Problem

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not store the data into a set of session variables?
User avatar
will83
Forum Commoner
Posts: 53
Joined: Thu Nov 10, 2005 3:13 pm

Post by will83 »

Ok thanks for that
User avatar
will83
Forum Commoner
Posts: 53
Joined: Thu Nov 10, 2005 3:13 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why wouldn't sessions provide for that too?
Post Reply