Session problem

Reply

Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Session problem

 
0
  #1
Aug 18th, 2007
I've installed Apache2.2.4 & php5.2.3 in my windows xp, evry thing is going perfect but when I want to transfer a session variable to another form its not tranfering.......plz any body help me on this regard. will I have to configer any file....its urgent for me..
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 223
Reputation: Anonymusius is on a distinguished road 
Solved Threads: 10
Anonymusius's Avatar
Anonymusius Anonymusius is offline Offline
Posting Whiz in Training

Re: Session problem

 
0
  #2
Aug 19th, 2007
Maybe post some code? All I can do now is direct you to PHP's session page. http://nl3.php.net/manual/en/ref.session.php
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: Session problem

 
0
  #3
Aug 19th, 2007
thanx 4 response
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 4
Reputation: Sabia is an unknown quantity at this point 
Solved Threads: 1
Sabia's Avatar
Sabia Sabia is offline Offline
Newbie Poster

Re: Session problem

 
0
  #4
Aug 20th, 2007
try using session_start()

here is a quick example
Session example
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 71
Reputation: Pro2000 is an unknown quantity at this point 
Solved Threads: 1
Pro2000's Avatar
Pro2000 Pro2000 is offline Offline
Junior Poster in Training

Re: Session problem

 
0
  #5
Aug 23rd, 2007
try using session_start()
You should put session_start() In each page in the first, and write a variable contains the session... EX:

session_start();
$_SESSION['user']="NAME";
$Variable=$_SESSION['user'];


It's Easy
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 52
Reputation: JeniF is an unknown quantity at this point 
Solved Threads: 5
JeniF's Avatar
JeniF JeniF is offline Offline
Junior Poster in Training

Re: Session problem

 
0
  #6
Aug 25th, 2007
I have a page that shows job posings and the recordset contains the job title called Position
on my first page I start the session, name the session and give it the value of the recordset like this:

session_start();
$_SESSION['Position']= $row_rsposition['Position'];


on the next page, I once again start the session and echo it to the screen to test it like so:

session_start();
echo $_SESSION['Position'];

you can further assign it to values on the form like this:
(this is a checkbox element)
<input name="Administrative_Support_Assistant" type="checkbox" id="Administrative_Support_Assistant" value="Y" <? if (!$_POST && (!(strcmp($_SESSION['Position'], "Administrative Support Assistant")))) { echo "checked=\"checked\"";} ?>/>

for a text box use something like this:
<input name="Position" type="text" id="Position" value=" <? echo $_SESSION['Position'];?>"


hope this helps
I keep hitting "escape", but I'm still here!!!!
:}
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: Session problem

 
0
  #7
Aug 28th, 2007
Now I've installed XAMPP but still facing problem on session:
e.g. file1.php
  1. <?
  2. session_start();
  3. session_register("n");
  4. <body><form action=file2.php method=post>
  5. ..........
  6. <input type=text name=n>
  7. <input type=submit value=submit>
  8. </body>
  9. ?>

file2.php

  1. <?
  2. session_start();
  3. session_register("n");
  4.  
  5. print"name=.$n";
  6.  
  7. ?>

the value of "n" is not printing on file2.php ..................if there is anything wrong in this code, plz give me some correct one........
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,661
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 550
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Session problem

 
0
  #8
Aug 28th, 2007
First off, the code you posted is not even valid code. You have php and html mixed in together and no end form tag to boot. Have you even attempted to run this code yourself?

As far as session, you have not set the value of 'n' in the session. In your code, 'n' is a post variable. If you want it in $_SESSION[] you need to set the value yourself. If you only need it the one time, then just read it from $_POST[]. If it needs to persist, set it in $_SESSION[].

It is fairly obvious that you are not reading any of the tutorial links that were posted, but just expecting people to write the code for you. You need to take the time to read and learn from the tutorials and php manual as well.
Last edited by Ezzaral; Aug 28th, 2007 at 7:19 pm. Reason: typo
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: Session problem

 
0
  #9
Aug 29th, 2007
thanx for the suggestion......i got it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1
Reputation: jocbed60 is an unknown quantity at this point 
Solved Threads: 0
jocbed60 jocbed60 is offline Offline
Newbie Poster

Re: Session problem

 
0
  #10
Aug 29th, 2007
Are you sure to have session_start(); at the first line of your page
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1545 | Replies: 9
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC