Jump to content


Photo

"Solved" Cookie


  • Please log in to reply
3 replies to this topic

#1 imartin123

imartin123
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 October 2006 - 06:41 AM

I am new to PHP. Need Help.

I have set cookie and I can use the in all my scripts except 1.

When I try to use it in this one script it is blank but I can still see it
in all other scripts.

Can anyone help me with this.

Also I will be happy to make a donation the cause in the next few days.

Thanks

Ike

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 09 October 2006 - 06:46 AM

Please post the code for the page in question.. use the bbcode tags like this..


[code]
<?php
//yourcode here
?>
[/code]


Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 imartin123

imartin123
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 October 2006 - 08:43 PM

In testing when I try to move my cookie to another var
it comes up blank.

Also when I change this test to echo other vars
I get the same info. It don't show a new echos.

Thanks for any help.

Ikw


<?php
echo $Var;

$Mycookie = $_Cookie['Testvar'];
echo $Mycookie;
echo "Here Test";

echo "IKE";
echo $Var;

?>


#4 amalosoul

amalosoul
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 09 October 2006 - 08:55 PM

You first have to start a session in order to pass variables without $_GET,$_POST
so this is your first file:
1.
<?php
session_start();
$_SESSION[var]='string';
?>
this is the second file that will use it
2.
<?php
session_start();
$var=$_SESSION[var];
echo $var;
?>

the second file will echo your string. You can also use session_destroy when you don't need to use your cookies anymore (they will still be available for that page, to deal with this problem check unset)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users