Announcement

Collapse
No announcement yet.

Cookies Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cookies Help

    can i know how to undate the cookie content when ppl click the submit button

    PHP Code:
    setcookie("Name",$name,.....) 
    for example the cookie content variable is $name

  • #2
    If you want to update the cookie content, you could just make it get rid of the old content and then add it again

    Comment


    • #3
      hmm, tired that, but seems to have a little problem with that.

      Comment


      • #4
        the code is somethign like this

        User Fill The form, sumbit button is named as "update"

        under this update, i delete the cookie and set it again liek this
        PHP Code:
           setcookie("theme","",mktime(0,0,0,1,1,1999));
            
        mysql_select_db($dbname2$db);
            
        $result mysql_query("SELECT * FROM profile WHERE user_name='$name'",$db);
            
        $row mysql_fetch_array($result);
            
        $update "UPDATE profile SET ........";
            
        $result2 mysql_query($update);
            
        setcookie("name",$name,mktime(0,0,0,1,1,2020),"/",".2gamerz.net",0);
            
        setcookie("theme",$theme,mktime(0,0,0,1,1,2020),"/",".2gamerz.net",0); 
        cannot work, measn that when user clickteh submit button, the cookies info is not uopdated

        Comment


        • #5
          Is all this before a head tag, coz cookies can only go before head tags and everything else, otherwise they don't work

          Comment


          • #6
            Originally posted by Steviepowers
            Is all this before a head tag, coz cookies can only go before head tags and everything else, otherwise they don't work
            yap it is above

            Comment


            • #7
              Here are my cookies that I use on my forums...

              Clear cookies:
              setcookie("password","",1);
              setcookie("username","",1);

              Set cookies:
              setcookie("username","$T1",3600);
              setcookie("password","$T2",3600);

              Comment


              • #8
                hmmm

                replace the mktime with a value 1.

                i hope it works

                Comment


                • #9
                  Originally posted by GamerZ
                  hmmm

                  replace the mktime with a value 1.

                  i hope it works
                  Hmm, nevermind, i find another way

                  thnaks

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X