How to Remove Cookies From a Post Array

The PHP language creates an array of cookies you use in the "post" data between pages. When you no longer need a cookie, you can delete it from the array. PHP includes a "setcookie" function that adds and removes cookies from the post array. Setting a cookie's expiration date in the past forces the browser to remove the cookie.

Instructions

    • 1

      Right-click the PHP page that contains your cookie code. Click "Open With" and select your preferred PHP editor.

    • 2

      Scroll down the page to the location of the cookie. Typically, this is at the bottom of a log-out function or the end of the page after the rest of the code uses the data.

    • 3

      Remove the cookie. The following code removes a cookie:

      setcookie ("mycookie", "", time() - 3600);

      Replace "mycookie" with the name of the cookie you want to remove.

Related Searches:

References

Comments

Related Ads

Featured