how to pass variable from one php to other when global is of

  • rrasin
  • Newbie
  • Newbie
  • User avatar
  • Posts: 11

Post 3+ Months Ago

I want to pass a variable from one php to another php which is accessing mysql. But my service provider has kept off the global. Please help to solve this problem.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

You might need to be a little bit more specific ... do you want to pass a variable from one page to another or do you want to pass it from one function to another or what exactly do you want to do?
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

If your scripts rely on global variables to be registered, they need to be updated. What you're looking for are sessions, either by manually setting and reading cookies with unique identifiers or with the session_*() functions.

See here to get started:
http://www.php.net/manual/en/function.session-start.php
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

GET variables would also work. ?id=1234&action=cheese
  • rrasin
  • Newbie
  • Newbie
  • User avatar
  • Posts: 11

Post 3+ Months Ago

righteous_trespasser wrote:
You might need to be a little bit more specific ... do you want to pass a variable from one page to another or do you want to pass it from one function to another or what exactly do you want to do?


i have an array of variables. i have listed the variables with link to another php. Now if the user clicks the link i should fetch the data from mysql relevant to the particular variable. I tried with session, but the last variable in the array list is passed to the next php. My service provider has kept off the global.
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

store the array in a single session variable

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 161 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.