473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to pass session names

1
Hi there,

I want to wrap the following code in a function called ssGet() so I do not have to call isset() every time.
Expand|Select|Wrap|Line Numbers
  1. //example db_var actually loaded dynamically
  2. $db_var = 2;
  3.  
  4. if isset($_SESSION['sess']['page'][$db_var]['myvar']))
  5. {
  6.   $ret = $_SESSION['sess']['page'][$db_var]['myvar']
  7. }
  8. else
  9. {
  10.   $ret = false;
  11. }
  12.  
  13. How do I pass the session variable name in ssGet()?
  14.  
  15. Is this possible? I would like to use it something like:
  16.  
  17. // set somewhere else
  18. $_SESSION['sess']['page'][$db_var]['myvar'] = 10;
  19.  
  20.  
  21. if ($myvar = ssGet("['sess']['page'][$db_var]['myvar']))
  22. {
  23.  // do something because myvar is set
  24. }
I may have more or less array levels.

many thanks for any and all suggestions.

best regards,
billc
Sep 21 '07 #1
1 1151
pbmods
5,821 Expert 4TB
Heya, Bill. Welcome to TSDN!

Please use CODE tags when posting source code:

[CODE=php]
PHP code goes here.
[/CODE]
Sep 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: opt_inf_env | last post by:
Hello, I have a page such that each user can see only a corresponding (personal) part of the page. In the beginning I wanted to perform initialization of users (by asking there names and...
3
by: Daniel Schwab | last post by:
Hi I have a C# component which needs to be accessed from ASP-Pages (not .net, old-style-asp). I cannot convert the asp pages to aspx pages at this time! They need to remain in ASP for a while....
4
by: acool | last post by:
I want the ability to fill in the public properties of a given class in a webform pump that class into a session variable and then recreate a new instance of that class in order to grab those same...
1
by: Daniel Michaeloff | last post by:
Hi all, I have an application that when finished redirects to a non-ASP.NET app which is choking on a huge ASP.NET session cookie. The cookie "ASP.NET_SessionId" gets transmitted by the browser...
2
by: macyp | last post by:
I have to pass values from one aspx page to another. The controls I have in the first page are: a textbox, 3 drop down lists, and 2 check boxes, and a submit button. It is a search page, and the...
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
7
by: Victor | last post by:
I've got two domain names sharing the same IP address that use ASP VBScript If I set a session variable with domain 1, it is only available for domain 1 - this is correct? If I set an...
10
by: Robert Dailey | last post by:
Hi, I noticed in Python all function parameters seem to be passed by reference. This means that when I modify the value of a variable of a function, the value of the variable externally from the...
9
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.