Session problem
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..
nil_gh_80
Junior Poster in Training
64 posts since Aug 2007
Reputation Points: 8
Solved Threads: 2
nil_gh_80
Junior Poster in Training
64 posts since Aug 2007
Reputation Points: 8
Solved Threads: 2
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)
/>
for a text box use something like this:
JeniF
Junior Poster in Training
52 posts since Aug 2007
Reputation Points: 10
Solved Threads: 5
Now I've installed XAMPP but still facing problem on session:
e.g. file1.php
<?
session_start();
session_register("n");
<body><form action=file2.php method=post>
..........
<input type=text name=n>
<input type=submit value=submit>
</body>
?>
file2.php
<?
session_start();
session_register("n");
print"name=.$n";
?>
the value of "n" is not printing on file2.php ..................if there is anything wrong in this code, plz give me some correct one........
nil_gh_80
Junior Poster in Training
64 posts since Aug 2007
Reputation Points: 8
Solved Threads: 2
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.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
thanx for the suggestion......i got it.
nil_gh_80
Junior Poster in Training
64 posts since Aug 2007
Reputation Points: 8
Solved Threads: 2