PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
vickriz
Forum Newbie
Posts: 5 Joined: Tue Aug 12, 2003 11:16 pm
Location: Phlippines
Contact:
Post
by vickriz » Fri Nov 21, 2008 7:28 pm
Hello I'm having a little problem with php sessions. I'm trying to test the code below and wants to print the value after submit the form.
http://abetterc.ipower.com/sessionTest1.php
This is my codes:
sessionTest1.php
Code: Select all
<?php
session_save_path(home/users/web/b1631/ipw.abetterc/public_html/cgi-bin/tmp);
session_start();
?>
<html>
<head><title>Testing Sessions page 1</title></head>
<body>
<?php
$_SESSION['session_var'] = "testing";
echo "This is a test of the sessions feature.
<form action='sessionTest2.php' method='POST'>
<input type='hidden'
name='form_var' value='testing'>
<input type='submit' value='go to next page'>
</form>";
?>
</body></html>
sessionTest2.php
Code: Select all
<?php
session_save_path(home/users/web/b1631/ipw.abetterc/public_html/cgi-bin/tmp);
session_start();
?>
<html>
<head><title>Testing Sessions page 2</title></head>
<body>
<?php
echo "session_var = {$_SESSION['session_var']}<br>\n";
echo "form_var = {$_POST['form_var']}<br>\n";
?>
</body></html>
The problem is that the session_var is not appearing. How to correct my code? Any advice will appreciated very much.
Thanks,
Vick
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Nov 21, 2008 8:23 pm
Code: Select all
session_save_path(home/users/web/b1631/ipw.abetterc/public_html/cgi-bin/tmp);
=>
Code: Select all
session_save_path('/home/users/web/b1631/ipw.abetterc/public_html/cgi-bin/tmp');
and make sure this directory is writable ...
There are 10 types of people in this world, those who understand binary and those who don't
califdon
Jack of Zircons
Posts: 4484 Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA
Post
by califdon » Fri Nov 21, 2008 11:00 pm
Perhaps you have a need to specify the save path for the session variables, but letting it use the default is satisfactory for most situations.