baijiazi Posted October 24, 2011 Share Posted October 24, 2011 Hi all, I have just started learning PHP. I hit into this wall currently where I have a page(main.php) which stores the session value 'name' of the login personnel.On login to main.php, some sql scripts will run and username and some values will be shown on the page. The page also allows user to input some values and on submit, the value will be send to confirm.php to validate. So on confirm.php, I have this small code if ($tday < $day){ if($tmth <= $mth){ echo "Please select a valid Date!!"; header("Refresh: 3; url=http://localhost/main.php");} else{ $tempDay = cal_days_in_month(0,$mth,$yr); $tempTotal = $tday + ($tempDay-$day); $calDays = $tempTotal + 1; echo "Total Number of Days Taken is ".$calDays; } } This line header("Refresh: 3; url=http://localhost/main.php"); will redirect back to the previous page automatically after 3 seconds.but I find that the session value 'name' is not loaded. anyway i can change it to reload the whole main.php? TIABai Link to comment Share on other sites More sharing options...
birbal Posted October 24, 2011 Share Posted October 24, 2011 i am not sure what do you mean byy raloading whole main.php .did you started session_start() in that page where you want to pull data of session? Link to comment Share on other sites More sharing options...
baijiazi Posted October 25, 2011 Author Share Posted October 25, 2011 Hi, Sorry abt it think I found my problem. $_SESSION['name'] = $_POST['fname']; think the page also reloaded this and as fname is empty, the session name is also empty. I put an if statement in front to do a check if fname have value before assigning it to session name and it work. Thanks for the reply. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.