Odd cookie behavior

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chuck W.

    #1

    Odd cookie behavior

    I'm processing a form, and on the target posting page, I'm setting
    cookies for the name/value pairs like this:

    while (list($name, $value) = each($HTTP_POST _VARS))
    {
    if ( $value <> NULL ) {
    setcookie($name ,$value,time()+ 3600*24*30*12*1 0);
    $mystring = "<input type=\"hidden\" value=\"$value\ " name=\"$name\"> \n
    $mystring";
    }
    }

    Now after posting when I go back to my original form with the same URL
    path,

    www.mydomain.com/mypath,

    I can see that the cookies are there because the values appear in the
    fields like we'd expect. However if I put the very same form in a
    different directory, eg: www.mydomain.com/secondpath then the cookied
    values no longer appear.

    I knew that cookies could be domain specific, but is there a setting
    that makes them somehow directory specific??

    Thanks,

    Chuck

  • frizzle

    #2
    Re: Odd cookie behavior


    Chuck W. wrote:[color=blue]
    > I'm processing a form, and on the target posting page, I'm setting
    > cookies for the name/value pairs like this:
    >
    > while (list($name, $value) = each($HTTP_POST _VARS))
    > {
    > if ( $value <> NULL ) {
    > setcookie($name ,$value,time()+ 3600*24*30*12*1 0);
    > $mystring = "<input type=\"hidden\" value=\"$value\ " name=\"$name\"> \n
    > $mystring";
    > }
    > }
    >
    > Now after posting when I go back to my original form with the same URL
    > path,
    >
    > www.mydomain.com/mypath,
    >
    > I can see that the cookies are there because the values appear in the
    > fields like we'd expect. However if I put the very same form in a
    > different directory, eg: www.mydomain.com/secondpath then the cookied
    > values no longer appear.
    >
    > I knew that cookies could be domain specific, but is there a setting
    > that makes them somehow directory specific??
    >
    > Thanks,
    >
    > Chuck[/color]

    Not sure about this, but have a look at the PATH - paramet:


    Comment

    • Chuck W.

      #3
      Re: Odd cookie behavior

      That was certainly it, thanks!!

      Comment

      • frizzle

        #4
        Re: Odd cookie behavior


        Chuck W. wrote:[color=blue]
        > That was certainly it, thanks!![/color]

        Glad to help.

        Comment

        Working...