473,466 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

getting function varible and storing it in php session

32 New Member
hi guys i'm a little confuse about getting a variable in function and storing it in session example :

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. function loadContent(paging) 
  4. {
  5.       <?      
  6.         $_SESSION['page']=?????? (this is what confuses me because i   
  7.                 have been trying to get the variable "paging" and is not working)
  8.       ?>
  9. }
  10. </head>
  11. <body>
  12. <span style='cursor: pointer;color:#0033FF' onClick='loadContent(2);'>
  13. </body>
  14. </html>
  15.  
does anyone has a suggestion??
Oct 27 '08 #1
3 1092
Markus
6,050 Recognized Expert Expert
You can't do that. Once PHP has finished, you can't communicate with it. You'll either have to reload the page and set 'paging' as a URL param (GET) or use AJAX (not sure if AJAX will work for setting sessions).

Ajax tutorial: http://www.tizag.com/ajaxTutorial/

GET tutorial: http://www.tizag.com/phpT/postget.php

Markus.
Oct 27 '08 #2
dbest5250
32 New Member
ic thanks markus. but is it possible if i used cookie? if it is possible how do i use itu? thanks in advance
Oct 27 '08 #3
dlite922
1,584 Recognized Expert Top Contributor
ic thanks markus. but is it possible if i used cookie? if it is possible how do i use itu? thanks in advance
http://php.about.com/od/advancedphp/qt/php_cookie.htm
Oct 28 '08 #4

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

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: prash | last post by:
Hello all I have a strange problem at the moment .I use iis5 to do my asp pages with vb scripts when i set session("myvar")="anyvalue" in my first page i cannot read the session variable in...
6
by: Jim Steinberger | last post by:
Hey all - my inaugural post, I have a Java web application on Tomcat 5 using pg73jdbc3.jar to connect to PostgreSQL 7.3.4 running on the same server (Red Hat Linux ). I have a Perl...
3
by: renjucool | last post by:
I am developing an online bug tracking system in asp.net.IT is implemented now in our office,at a time around 10-15 peoples are using.Web application is hosted in a local machine(core 2duo-1 gb...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.