session variables - into into database

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
jarow
Forum Commoner
Posts: 83
Joined: Tue Jan 28, 2003 2:58 am

session variables - into into database

Post by jarow »

I have a 2 page form. The first page page of the form POSTS to the 2nd page which, after being filled out, should send all the information (from pages 1 and 2) to the database. I have created a session variable and have placed it at the top of the 2nd page. For brevity´s sake I have placed only one of the variables in this example:

<?php
session_start();
$_SESSION["sessanimals"] = $_POST["animals"];
?>

After filling out the remaining variables on page 2, I want all the information (the info from page 1 brought over in the session variable and the info from page 2) sent to the database. I tried creating an INSERT RECORD on page 2 but only the variables on page 2 are subsequently sent upon submission. How do I get all the info into my database??

Here are a list of my questions:

1. Is there any way of creating one session variable for all my page 1 form variables (I have 20+ variables)?
2. is there a way to denote ALL the variables in = $_POST[]; or do they have to be listed separately?
3. How do I post all the data from page 1 and 2 into my database at once?

Thanks very much

Jim
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

treat the session variable as if it's an array
Post Reply