i set cookies to expire at session end by just leaving time out. this works fine if i close the entire browser. but if i just close the tab w my script on it it doesn't expire cookies. I really would like for them to expire even in tabbed browser. any ideas? here's my cookie page:

<?php

// Write the current month and year into cookies and return back to index.php

$month=$_GET['m'];
$mon=$_GET['mon'];
$year=$_GET['y'];
$ti= $_GET['ti'];





setcookie("month", $month);
setcookie("mon", $mon);
setcookie("year", $year);
setcookie("ti", $ti);

header ("location: index.php");



?>

Recommended Answers

All 2 Replies

If you know when your session is done, you can delete the cookie and see if that does it. If the session just dies without warning (and you don't explicitly delete it)then I think that the cookie will hang around until the browser is closed and opens again.

so you dont think there is a way to do it then? I wasnt sure. I dont want to have to manually delete them, because this needs to be a fully self functioning app for use of others as well. It doesnt cause a big flaw in my app, just a lil annoyance is all. it may even be acceptable, was just hoping to make cookies go away even when tab is closed and browser is still running. thanks for your reply :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.