Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

$_SESSION predefined vars

session

  • Please log in to reply
5 replies to this topic

#1 gregshu

gregshu

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 19 August 2008 - 06:59 AM

I hope this is the right group...I need a bigger brain to help explain what is going on....
I am new to PHP and counting on someone with an answer....

I have an main page (index.php) that has links with hrefs set to itself (index.php -below).
I dump out some $_SESSION predefined vars, but each time I click on the link(s) the values continue to get larger. I am not sure what or how to correct this?

Hope someone can enlighten me.
Thanks
Greg

------------- Sample Page index.php ----------------

<html>
<head>
<?php
echo 'Php_Self: '. $_SERVER['PHP_SELF'] .'<br>';
echo 'Path_Info: '. $_SERVER['PATH_INFO'] .'<br>';
echo 'QueryString: '. $_SERVER['QUERY_STRING'] .'<br>';
echo 'RewuestURI: '. $_SERVER['REQUEST_URI'] .'<br>';
?>
</head>

<body>
<div>
Web Content<br>
<a href="index.php/HOME/WELCOME">Welcome</a><br>
<a href="index.php/HOME/FEES">Fees</a><br>
</div>
</body>
  • 0

#2 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 19 August 2008 - 07:35 AM

Your links don't go to index.php actually.

The page being requested is:

http://yoursite/index.php/home/welcome

which isn't index.php

I don't see anything in your code about session variables.
  • 0

#3 gregshu

gregshu

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 19 August 2008 - 07:44 AM

I am sorry but I meant the $_SERVER predefines. Too early in the morning.
  • 0

#4 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 19 August 2008 - 08:52 AM

The values are getting bigger because of the way your links are setup.

Your not linking to index.php your linking to a file called "index.php/HOME/WELCOME" and "index.php/HOME/FEES"

The values get larger on these links, because the server is seeing them as different pages.
  • 0

#5 gregshu

gregshu

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 19 August 2008 - 09:38 AM

hmmm, so are you saying that if I change it to something like...
index.php?m=HOME&s=WELCOME
would it work??
Thanks
  • 0

#6 John

John

    CC Mentor

  • Moderator
  • 4450 posts
  • Location:New York, NY

Posted 19 August 2008 - 12:38 PM

hmmm, so are you saying that if I change it to something like...
index.php?m=HOME&s=WELCOME
would it work??
Thanks


Yes. If you want to do it your way, you have to use the absolute url (http://www.example.c...x.php/HOME/.../).
  • 0





Also tagged with one or more of these keywords: session

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download