| | |
Session problem
![]() |
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
•
•
•
•
try using session_start()
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!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
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
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!!!!
:}
:}
Now I've installed XAMPP but still facing problem on session:
e.g. file1.php
file2.php
the value of "n" is not printing on file2.php ..................if there is anything wrong in this code, plz give me some correct one........
e.g. file1.php
php Syntax (Toggle Plain Text)
<? 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
php Syntax (Toggle Plain Text)
<? 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........
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.
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
![]() |
Similar Threads
- Session problem in asp (ASP)
- timeout session problem (JSP)
- PHP Session Problem (PHP)
- PHP sessions/$_POST problem. Too Stressed today! (PHP)
- Please Help Header Error (PHP)
- CF 6.1 problems..Junior Programmer - NEED HELP! (ColdFusion)
- Help with Forums. (PHP)
Other Threads in the PHP Forum
- Previous Thread: CAPTCHA Help
- Next Thread: From a PHP DWEEB!!
Views: 1545 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess ajax apache api archive array arrays auto binary box broken buttons cakephp cart check checkbox class cms code cron database date delete directory display download dropdown drupal dynamic echo email error file files form forms function functions google header hosting htaccess html image include insert integration ip java javascript joomla limit link list login loop mail methods mlm mod_rewrite multiple mysql order parse paypal php problem query radio recursion redirect regex remote rows script search select server session soap sort source speed sql string syntax table tutorial update upload url user validation validator variable video web website wordpress xml






