Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Processing multiple forms using sessions

Featured Replies

I am building a registration system that processes multiple registrations by the same payer (eg a student registering in more than one course and/or more than one student registering in the same course).

If I use sessions to keep all variables in play, how do I process the web form data to a database? Do I do it bit by bit using a Submit button on each web form or wait until I have all the form fields entered and do one big processing to the database at the end? If so, how does the final Submit button know to process the data from all the earlier forms as they are not connected by the same HTML code?

Cheers,

Steven

hmm

This is quite a good project.

The key is planning and vision.

What do you want entered in what database?

For instance in our shopping cart solution, we have a specific order database that tracks the contents of the cart and we add and change data with that database on the fly.

Then when a person is ready to checkout, we connect that data with a customer number and process the orders.

Similarly with your courses, you would have your "Shopping cart" or courses, A "Customer" and then a "commit" to an order.

You may want to do some of both. It is a big task to keep track of all the session variables without storing them in a temporary database somewhere.

As for entering session variables into the database, it should be similar to $_GET and $_POST.

1. send the person to a checkout page

2. Grab all session variables and place in variables

3. Create a New or Edit and old record using these variables.

ie)

$name = $_SESSION['name'];

etc.

  • Author

Hi Mark,

Thanks for that.

So I think I need to do all of the following:

1. Start each page (.php) in the process with session_start();

2. List all session variables on the first page of the process (I'm not sure if this is necessary):

$_SESSION['coursecode']='';

$_SESSION['coursename']='';

$_SESSION['dates']='';

$_SESSION['venue']='';

$_SESSION['presenters']='';

$_SESSION['payers']='';

$_SESSION['payername']='';

$_SESSION['payerphone']='';

etc.

3. Based on what you have said, add all session variables to the last page in the process where the data gets submitted to the database:

$name = $_SESSION['name'];

$coursecode = $_SESSION['coursecode'];

$coursename = $_SESSION['coursename'];

$dates = $_SESSION['dates'];

$venue = $_SESSION['venue'];

$presenters = $_SESSION['presenters']';

$payers = $_SESSION['payers'];

$payername = $_SESSION['payername'];

$payerphone = $_SESSION['payerphone']';

etc.

Is that eveything?

Cheers,

Steven

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.