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..

try using session_start()

You should put session_start() In each page in the first, and write a variable contains the session... EX:


It's Easy

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= $row_rsposition;

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

echo $_SESSION;

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, "Administrative Support Assistant")))) { echo "checked=\"checked\"";} ?>/>

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

hope this helps

Now I've installed XAMPP but still facing problem on session:
e.g. file1.php

<body><form action=file2.php method=post>
<input type=text name=n>
<input type=submit value=submit>





the value of "n" is not printing on file2.php ..................if there is anything wrong in this code, plz give me some correct one........

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.

This article has been dead for over six months. Start a new discussion instead.