View Full Version : calling Session variables for Database submissions

12-15-2005, 12:43 AM
I am pretty new to Dreamweaver, and have read all I can on this issue, so firgive me if the answer is obvious.

I have successfully created a login page, as well as all of my database tables. I am able to successfully register and login my users. However, it seems that I am unable to call the session variables.

What is going on is this: My web site is designed for inventory management. After a user logs in, the user will then be able to add, edit, and delete their inventory items. When a new item is posted, I have hidden fields (company_name, post_ip, post_time, post_date, id, username, etc). My problem is that the hidden form fields company_name, id, contact_name (the person's name) are not being inserted into the database.

I have all the appropriate recordsets created, as well as the dynamic text to display session variables. Somehow, I know there is a way that when a user logs in, the entire row of the table can be registered as a session variable. But how?

Any ideas? I will post the code if anyone needs it.

12-15-2005, 04:56 AM
I have made some progress. It seems like I have made a small error somewhere. From what I can tell from my experimenting, if the PHPSESSID is added to the end of any URL, the session variables work.

How do I put the PHPSESSID in the url of all pages that are calling session variables?

12-15-2005, 05:40 AM

Creative Insanity
12-15-2005, 06:59 AM
wait a sec.. most are either in bed or still at work.
Someone will answer in due course.

12-15-2005, 07:38 AM
<a href="newpage.php?var1=1&var2=2&var3=thisisastring">click here to pass vars</a>

<a href="newpage.php?var1=1&var2=2&var3=<?php echo $_SESSION['sessionvar']; ?>" >click here to pass vars</a>

12-15-2005, 06:21 PM
Lol. Sorry. I seem to loose all sense of time when I am working on my web sites. Day is night and night is day. I don't think I am the only one......

12-15-2005, 06:22 PM
I will give that a shot. Thank you!!

12-16-2005, 03:28 AM
Being so new to Dreamweaver, and some-what new to PHP is a factor here, I am sure.

My URL is www.XSStock.us.

To better understand my problem visually, click on "Corporate Login", and login with demo/demo. Once you do, click on "Inventory". That takes you to the Inventory Management page. There are two fields that should be populated from session variables; Company Name and Submitted by. For some reason, they are not being populated.

I have used everything stock right out of DW, so no modifications have been made to the code. I have read on the net that DW does not fully enable session variables, and that code alterations are a must in order to use session variables to the fullest.

If anyone has any suggestions, please let me know. I will be sitting here staring at this for a long time. My AIM name is BrettAPower.

P.S. One thing I have noticed is that the PHPSESSID changes whenever the page is refreshed or if the user goes to another page. This isn't suppose to happen, right?

Thanks in advance.

12-16-2005, 03:41 AM
<a href="newpage.php?var1=1&var2=2&var3=thisisastring">click here to pass vars</a>

<a href="newpage.php?var1=1&var2=2&var3=<?php echo $_SESSION['sessionvar']; ?>" >click here to pass vars</a>
I am most likely doing something wrong here, but it did not work for me.

Do I only change "newpage.php" to my file name? Or do I have to change more than that. Something tells me I do.

12-16-2005, 03:49 AM

It has something to do with includes. I am going to change a few things around, and see what rolls. Wish me luck!