setcookie

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Katherine Hall

    setcookie

    I am trying to set a cookie and use it later, but as soon as put a redirect
    or anything, I loose it.

    So when I first print it out, it exists. When I go to my redirect page it's
    gone.
    first page:

    print_r($_COOKI E);
    $url = "../somepage.php";
    $target = "parent";
    $delay = "4";
    echo '<meta http-equiv="refresh" content="'.$del ay.';url='.$url .'">';


  • Katherine Hall

    #2
    Re: setcookie

    I should mention that somepage.php has frames.

    Thanks

    "Katherine Hall" <katherine@mana iakoru.com> wrote in message
    news:r5QNd.6106 $Ub4.384792@new s20.bellglobal. com...[color=blue]
    >I am trying to set a cookie and use it later, but as soon as put a redirect
    >or anything, I loose it.
    >
    > So when I first print it out, it exists. When I go to my redirect page
    > it's gone.
    > first page:
    >
    > print_r($_COOKI E);
    > $url = "../somepage.php";
    > $target = "parent";
    > $delay = "4";
    > echo '<meta http-equiv="refresh" content="'.$del ay.';url='.$url .'">';
    >
    >[/color]


    Comment

    • Randell D.

      #3
      Re: setcookie

      Katherine Hall wrote:
      [color=blue]
      > I am trying to set a cookie and use it later, but as soon as put a redirect
      > or anything, I loose it.
      >
      > So when I first print it out, it exists. When I go to my redirect page it's
      > gone.
      > first page:
      >
      > print_r($_COOKI E);
      > $url = "../somepage.php";
      > $target = "parent";
      > $delay = "4";
      > echo '<meta http-equiv="refresh" content="'.$del ay.';url='.$url .'">';
      >
      >[/color]

      How do you set your cookie?

      You'll have to show us a little more code before I can advise where you
      are going wrong - And you could/should used the header() function to
      redirect as opposed to the meta http-equiv tag you're using.

      Start simple first, then work your way from there - Thus, create a
      simple page that says something like

      A file called page1.php follows:

      <?
      setcookie("myna me","Katerine Hall");
      header("Locatio n: page2.php");
      ?>

      A file called page2.php follows:
      <?
      print_r($_COOKI E);
      ?>

      The above should work - when you've tweaked with it a bit and got it
      working, then implement the code in to your real life scenario.

      Hope that helps,
      randelld.

      Comment

      Working...