...

View Full Version : problems with sessions(am a newbie)



afma_afma
05-02-2006, 09:01 PM
hello there i have a small problem (hopefully)

when i use the following code it is all working fine:
$stuname = 'aaa';
$stuaddr = 'bbb';


$_SESSION['d1'] = $stuname;
$_SESSION['d2'] = $stuaddr;

echo $_SESSION['d1'];
echo $_SESSION['d2'];

aaa and bbb are echoed....but when i try to get value from two drop down menu to display the selected value like the below...i face problems....

$stuname = trim($_POST['dd1']);
$stuaddr = trim($_POST['dd2']);


$_SESSION['d1'] = $stuname;
$_SESSION['d2'] = $stuaddr;


echo $_SESSION['d1'];
echo $_SESSION['d2'];

the echoed value is not printed out...some one please help...

thanx in advance
ahmed

cdwhalley.com
05-02-2006, 09:03 PM
$_SESSION['d1'] = $a;
$_SESSION['d2'] = $b;

Where have $a and $b come from?

afma_afma
05-02-2006, 10:17 PM
sorry thats a mistake
....that is $stuname and $stuaddr

afma_afma
05-02-2006, 10:17 PM
$_SESSION['d1'] = $a;
$_SESSION['d2'] = $b;

Where have $a and $b come from?


sorry thats $stuname and $stuaddr

ClubCosmic
05-02-2006, 10:47 PM
i see you have posted twice on this topic.

instead of:

echo $_SESSION['d1'];
echo $_SESSION['d2'];
try:

$stuname = "{$_SESSION['d1']}";
$stuaddr = "{$_SESSION['d2']}";

then when you want to echo them:

echo $stuname . "<br>". $stuaddr;

afma_afma
05-03-2006, 01:25 AM
hi cosmic,
thanx for ur suggestions.can u tell me how i can assign a drop down menu value into a session variable.

thanx in advance..
ahmed::)



i see you have posted twice on this topic.

instead of:

echo $_SESSION['d1'];
echo $_SESSION['d2'];
try:

$stuname = "{$_SESSION['d1']}";
$stuaddr = "{$_SESSION['d2']}";

then when you want to echo them:

echo $stuname . "<br>". $stuaddr;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum