close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Question about Session variables

Thread began 5/09/2012 4:31 pm by iainmacdonald331081 | Last modified 5/10/2012 4:26 pm by iainmacdonald331081 | 1706 views | 8 replies


Question about Session variables

Just looking for some advice to see if I'm doing something remotely correctly with Sessions.... (not something I use too often)

I basically have a simple enough database structure with two tables:

Lodges - LodgeID, Lodge, etc
Nominations - NominationID, Nomination, LodgeID, etc

A one-to-many relationship, with each Lodge being able to have multiple Nominations.

So I have a Lodge Details page, which shows the details of a selected Lodge, and a little table listing the Nominations its had.

On this page I have a link to add a new Nomination, which should pick up the LodgeID of the current Lodge, so that the new Nomination is tied to the current Lodge.

So on my Lodge details page I have a session created using:

if (!session_id()) session_start();
if (!isset($_SESSION["Lodge_ID_Number"])) {
$_SESSION["Lodge_ID_Number"] = "".$row_WADAlodges['LodgeID'] ."";

On my Add Nomination page I have a hidden field that calls up the $_SESSION["Lodge_ID_Number"]:

<input type="hidden" name="LodgeID" id="LodgeID" value="<?php echo $_SESSION['Lodge_ID_Number']; ?>" />

And on my Nomination Added page I use unset to clear that Session using:


Hope that all makes sense.... it does seem to work, but I'm just interested to know if that's the best way of doing this, or if there's a better way?

The thing that's bugging me is what would happen if the user got as far as the Add Nomination page, and then hit the back button, went to a different Lodge, before the Session variable is cleared which might cause problems?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...