Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 26th, 2005, 05:07 PM
Authorized User
Join Date: Apr 2005
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem passing through sessions


I am working on chapter 2 of beginning php,mysql and apache - moviesite.php and movie1.php. I am now working on Passing variables through sessions. I have cut and past the code (which I downloaded from the wrox site) for both php files (therefore if the code is coming from the source, it surely must be ok).

Every time I click the hyperlink: "click here to see information...." on the movie1.php, it should return:

Welcome to our site Joe 12345
My favourite movie is Life of Brian
My movie rating for this movie is : 5

However (even when I use the code from the book) No session information is passed at all, and all I get is:

My favorite movie is Life of Brian
My movie rating for this movie is: 5

I have checked the registered globals are off (they are) and made sure the php.ini file "session_save_path" is pointing to the C:/temp (which it is).

Does anybody no whats wrong or what I am doing wrong? I basically can't progress through the book until I resolve the problem as the next section uses sessions and cookies, and It won't work if the sessions don't work.


Kind regards
Reply With Quote
  #2 (permalink)  
Old April 26th, 2005, 05:19 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

This is really pissing me off now!
Not the best way to solicit help from the community.

The book does have a forum:
http://p2p.wrox.com/book-asp-net-website-programming-problem-design-solution-23/0 (PHP 4 Book)
http://p2p.wrox.com/forum.asp?FORUM_ID=157 (PHP 5 Book)

Troubleshooting Sessions:
Did you restart Apache after setting the session.save_path directive?

Can you verify that session files are being created at C:\temp?

What about the session id, are you passing the session id via a URL or via cookies?

Are cookies enabled in your browser?

Can you verify that a session cookie is being created by your browser (find the raw cookie file for your domain)?

Does the cookie file have the session id in it?

Do you have a firewall enabled (sometimes a firewall can cause conflicts with the session cookie)?

Do you have error_reporting activated (error_reporting = E_ALL in php.ini)?

Are errors being logged (log_errors = off in php.ini)?

Are errors being displayed (display_errors = on in php.ini)?

As you can see lots of things can be misconfigured and cause you to miss out on error information, or cause your sessions to fail.

Finally, since not everyone has the book, post relevant snips of code, so we can see what you're working with.


Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply With Quote
  #3 (permalink)  
Old April 26th, 2005, 05:41 PM
Authorized User
Join Date: Apr 2005
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

Here is the code I have used....


<TITLE>Find my Favorite Movie!</TITLE>
     $myfavmovie=urlencode("Life of Brian");
     echo "<a href='http://localhost/moviesite.php?favmovie=$myfavmovie'>";
     echo "Click here to see information about my favorite movie!";
     echo "</a>";
//check to see if user has logged in with a valid password
     if ($_SESSION['authuser']!=1) {
     echo "Sorry, but you don't have permission to view this page, you loser!";
<TITLE>My Movie Site - <?php echo $_REQUEST['favmovie'] ?></TITLE>
     echo "Welcome to our site, ";
     echo $_SESSION['username'];
     echo "! <br>";
     echo "My favorite movie is ";
     echo $_REQUEST['favmovie'];
     echo "<br>";
     echo "My movie rating for this movie is: ";
     echo $movierate;


Hope this helps.


Reply With Quote
  #4 (permalink)  
Old June 15th, 2005, 03:17 AM
Friend of Wrox
Join Date: Mar 2004
Location: Bhopal, MP, India.
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul

Where are you passing SID?
Or do you've set session.use_trans_sid = 1 ?

Reply With Quote
  #5 (permalink)  
Old June 26th, 2006, 08:08 PM
Registered User
Join Date: Jun 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I have the same problem. I have spent 3 days looking at forums and have yet to find anyone with the solution to this problem.

The exact problem is that variables are not being passed form one page to another, either by post or sessions on my localhost. A large number of requests have been asked on different forums but no real answers have been given, hoping to get one here.

everyone just gives standard answers like use post and gives and examples , put session ast start of page (i know how to pass variables, I have done it hundreds of timesit works but not on my localhost)

I know how to do this it works on isp host
as do session but not no my local server. I have a number of site that work perfectly with sessions and passing from variables on isps but the same will not work on my localhost.

I have configed session to be on
register globals = off etc

tried adjusting buffer output.

I am using easyphp on a windows xp machine with apache server. I have upgraded php to 5 as I thought that might be the problem but still no fix.

Its as if the varibles are just not being sent. Because I can echo them on one page but when next page is loaded they do not exsist.

I really need help as I cannot develop locally with this continious problem..


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sessions, and passing data to another page mrjoka ASP.NET 2.0 Basics 2 March 13th, 2007 10:21 AM
Passing through sessions dmlocke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 May 15th, 2005 11:35 AM
Passing Variables through Sessions dmlocke Beginning PHP 2 April 27th, 2005 05:40 AM
passing through sessions not working dmlocke PHP Databases 2 April 26th, 2005 08:21 AM
Passing value without using sessions lic023 Classic ASP Basics 1 July 20th, 2004 09:58 AM

All times are GMT -4. The time now is 11:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.