pph Posted June 10, 2007 Share Posted June 10, 2007 my coding is session_start(); $age1=$_POST['age']; $age2=$_POST['age2']; $sex=$_POST['gender1']; $findcountry=$_POST['country']; session_register("age1"); session_register("age2"); session_register("sex"); session_register("findcountry"); echo $_SESSION['age1']."<br>"; echo $_SESSION['age2']."<br>"; echo $_SESSION['sex']."<br>"; echo $_SESSION['findcountry']."<br>"; This session is not having output. actually iam try to code page navigation example 1,2,3,... . thats the why i need to keep every time age1,age2,sex and country varibles for my sql syntax SQL code is $sql = "select * from penfriends where age>='$age1' and age<='$age2' and gender='$sex' and country='$findcountry' ORDER BY lname DESC LIMIT " . $Limit . " it will keep only page one(1,) but if i click page 2 its not going.thats mean no values going to 2,3 pages .can u please help me to solve this problem.thanks Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/ Share on other sites More sharing options...
chigley Posted June 10, 2007 Share Posted June 10, 2007 session_register() is now deprecated. Instead you should use $_SESSION["age1"] = "value"; Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271714 Share on other sites More sharing options...
pph Posted June 10, 2007 Author Share Posted June 10, 2007 then code be like session_start(); $_SESSION['age1']=$_POST['age']; //value form the search forms $_SESSION['age2']=$_POST['age2']; $_SESSION['sex']=$_POST['gender1']; $_SESSION['findcountry']=$_POST['country']; echo $age1."<br>"; echo $age2<br>"; echo $sex."<br>"; echo $findcountry."<br>"; Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271722 Share on other sites More sharing options...
chigley Posted June 10, 2007 Share Posted June 10, 2007 Don't assume register_globals is on... echo $_SESSION["age1"]."<br>"; //..... etc. Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271727 Share on other sites More sharing options...
pph Posted June 10, 2007 Author Share Posted June 10, 2007 after i code like this $_SESSION['age']=$_POST['age']; $_SESSION['age2']=$_POST['age2']; $_SESSION['sex']=$_POST['gender1']; $_SESSION['findcountry']=$_POST['country']; ////////////////////////////////////// $age1=$_SESSION['age']; $age2=$_SESSION['age2']; $sex=$_SESSION['sex']; $findcountry=$_SESSION['findcountry']; my SQL query is working only one time thats mean if i go next page its not working.how i hold the velue for long time,like page is going 1,2,3,4..etc. my SQL syntax is $qStr = "select * from penfriends where age>='".$_SESSION['age']."' and age<='$age2' and gender='$sex' and country='$findcountry'"; Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271738 Share on other sites More sharing options...
pph Posted June 10, 2007 Author Share Posted June 10, 2007 i already register_globals on. still its not working.please help me to solve this problem Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271799 Share on other sites More sharing options...
Trium918 Posted June 10, 2007 Share Posted June 10, 2007 i already register_globals on. still its not working.please help me to solve this problem By having register_globals = On is a security breach. I recommend you to turn register_globals = Off to avoid any security problems. Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271812 Share on other sites More sharing options...
pph Posted June 10, 2007 Author Share Posted June 10, 2007 if i OFF the register_global what is the problem in my code Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271862 Share on other sites More sharing options...
Trium918 Posted June 11, 2007 Share Posted June 11, 2007 if i OFF the register_global what is the problem in my code I'll help you tomorrow? We will get it working, ok? Quote Link to comment https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-272087 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.