Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/54942-session-problem/
Share on other sites

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>";

Link to comment
https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271722
Share on other sites

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'";

Link to comment
https://forums.phpfreaks.com/topic/54942-session-problem/#findComment-271738
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.