473,803 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cookies not deleted in browser

134 New Member
Hi

i m using cookies to store data in an form containing textfields

and using the following codes.,



Expand|Select|Wrap|Line Numbers
  1. <?
  2. $act=$_REQUEST['act'];
  3.  
  4. if($act==1)
  5. {
  6. $one=$_POST['1'];
  7. $two=$_POST['2'];
  8. $three=$_POST['3'];
  9.  
  10. setcookie ('field[1]', $one);
  11. setcookie ('field[2]', $two);
  12. setcookie ('field[3]', $three);
  13. ?>
  14. <meta http-equiv="refresh" content="0;url=cook.php">
  15. <?
  16.  
  17. }
  18. if($act=="del")
  19. {
  20. $f=$_REQUEST['f'];
  21.  
  22. if($f==1)
  23. setcookie ("field[1]", FALSE);
  24. else if($f==2)
  25. setcookie ("field[2]", FALSE);
  26. else if($f==3)
  27. setcookie ("field[3]", FALSE);
  28.  
  29. ?>
  30. <meta http-equiv="refresh" content="0;url=cook.php">
  31. <?
  32.  
  33. }
  34. $onec=$_COOKIE['field']['1'];
  35. $twoc=$_COOKIE['field']['2'];
  36. $threec=$_COOKIE['field']['3'];
  37. ?>
  38.  
  39. <form name="form1" method="post" action="cook.php?act=1">
  40. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  41.   <tr>
  42.     <td width="12%" height="22" align="center" valign="middle"><span class="style1">1</span></td>
  43.     <td width="75%" align="center"><label>
  44.       <input name="1" type="text" id="1" style="border:#FFFFFF; color:#CC3366;background:#FAECDF; border:none; " size="30" value="<? if($act==1) echo $one; else echo $_COOKIE['field']['1'];?>" />
  45.     </label></td>
  46.     <td width="13%"><a href="cook.php?act=del&amp;f=1"><img src="images/delete-btn.png" alt="exitbtn" width="15" height="15" border="0"/></a></td>
  47.   </tr>
  48.   <tr>
  49.     <td height="25"align="center" valign="middle"><span class="style3">2</span></td>
  50.     <td align="center" valign="middle"><input name="2" type="text" id="2" style="border:#FFFFFF; color:#CC3366;background:#FAECDF; border:none; " size="30" value="<? if($act==1) echo $two; else echo $_COOKIE['field']['2'];?>" /></td>
  51.     <td><a href="cook.php?act=del&amp;f=2"><img src="images/delete-btn.png" alt="exitbtn" width="15" height="15" border="0"/></a></td>
  52.   </tr>
  53.   <tr>
  54.     <td height="23" align="center" valign="middle"><span class="style1">3</span></td>
  55.     <td align="center"><input name="3" type="text" id="3" style="border:#FFFFFF; color:#CC3366;background:#FAECDF; border:none; " size="30" value="<? if($act==1) echo $three; else echo $_COOKIE['field']['3'];?>" /></td>
  56.     <td><a href="cook.php?act=del&amp;f=3"><img src="images/delete-btn.png" alt="exitbtn" width="15" height="15" border="0"/></a></td>
  57.   </tr>
  58. </table>
  59. </form>
  60.  
  61.  


when i implemented the above code.,

i got all the results perfectly.,

but in IE when i clear the cookies using the browser options i didnt get the cookies cleared and values are displayed in the corresponding fields.,

How can this possible., the cookies should get cleared right?


regards
vijay
Jul 5 '08
14 5225
vjayis
134 New Member
As pbmods already suggested, IE is showing you a cached version of the page. I'm going to say it again: you're not using PHP to delete the cookies, but the browser. Therefore, this isn't a PHP problem.



then what is the solution for this??

is there no way?
Jul 10 '08 #11
TheServant
1,168 Recognized Expert Top Contributor
then what is the solution for this??

is there no way?
So have you tried refreshing the page manually? If you can't, remove the meta refresh in your code and try again.

Have you set your cookie expiration anywhere, like your php.ini file (if that is where it is defined)? Have you tried it on a different computer/different browser?

If you have a cookie which won't allow itself to be removed then you have pretty amazing cookie. Otherwise you will need to try a browser troubleshooting page.

Are the cookies going into the usual cookie place? As in where your cookies usually go?
Jul 10 '08 #12
vjayis
134 New Member
So have you tried refreshing the page manually? If you can't, remove the meta refresh in your code and try again.

Have you set your cookie expiration anywhere, like your php.ini file (if that is where it is defined)? Have you tried it on a different computer/different browser?

If you have a cookie which won't allow itself to be removed then you have pretty amazing cookie. Otherwise you will need to try a browser troubleshooting page.

Are the cookies going into the usual cookie place? As in where your cookies usually go?

Tried refreshing the page by both ways.,

No i didnt hav set my cookie to expire anywhere.,

and already tried with different computers and browsers.

and my cookie is going to the usual cookie place only.,
i m damn sure abt this.,
Jul 10 '08 #13
TheServant
1,168 Recognized Expert Top Contributor
What is your cookie named? And just checking, the cookies from your site are the only ones not deleting? There are no other persistant cookies?
Jul 10 '08 #14
vjayis
134 New Member
hi

my cookies alone are not deleted.,
i tried by using the link

http://www.labpixies.c om/campaigns/todo/todo.html

and this too shows the cached page when i tried by deleting the cookies through browser settings(IE).,

but if i press delete all instead of pressing delete cookies in browser options., i get the new page with all cookies deleted.


and one more question

is there a limit to set number of cookies??

i need to set upto 30 cookie variables.,

is it possible.,

firefox allows me to set more than 30 cookie variables.,

but IE allows only 20 cookie variables to be set., if i m setting next cookie variable then the first cookie variable i had set gets expired..,

but i'm in need to set about 20 to 30 cookie variables.,

is there any way??
Jul 11 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4063
by: Phil Powell | last post by:
I am having this problem: My PHP script will set a cookie, it's there in my /Cookies folder. I delete the cookie (I have to for testing purposes, the PHP script I run behaves according to this cookie existing or not) and run the script again. Everything runs fine, but the cookie is never set again. Does anyone know why this happens? I am using Win2000 Professional with IE 6. Cookies are being set with PHP and Javascript. Thanx Phil
3
1819
by: John | last post by:
I am storing user names and addresses in cookies so that they do not have to enter them in forms. But now if I try to send the form with new data, the data in cookies is always called when I press the submit button. The data that I have entered get deleted and the data in the cookies is submitted. This also happens in scripts where I am not even using cookies to set the forms. How do I solve this problem? Thank you John
2
3347
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of the user. I want that cookie should get deleted when user closes the browser without signing out. I think it is done in global.asa file . But i don;t know how to do it?
9
2540
by: | last post by:
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be reading in online articles?
5
1935
by: anony | last post by:
Hi, I have a site that uses forms authentication to secure the directory. The site behaves as expected when viewed externally... if I close the browser and attempt to access it again, I get prompted to login. However, locally here on the network, if I close the browser and open a new one and access the site again, I don't have to login. Can anyone shed some light as to what's going on? Thanks,
5
5353
by: Miljana | last post by:
Hi, I have one problem with cookies in ASP.NET application. It seems that I can not retreive cookie from Request.Cookies collection. I put cookie in Response.Cookies collection, and after page post back, when I try to retreive it from Request.Cookies collection, it appears that it does not exists. This problem does not occur on several developing machines we use for developing application, but occurs in another environment (another...
7
2020
by: Marcus | last post by:
I know that when you start a session in PHP, the "cookie" it creates is not the same as those that are stored in your browser's temp folder, and instead is kept in RAM. I am confused because in every session tutorial I have ever read, the author invariably mentions the 2 main ways of propagating sessions - through cookies and appended to the URL. The author also almost always talks about the method being dependent on the user's...
2
1322
by: the friendly display name | last post by:
Easy to describe that problem: The cookies will be deleted after the user closes the browser, but I have set persistance to true. Code: ------ TicketForPremium = new FormsAuthenticationTicket(1, UserID, DateTime.Now, DateTime.Now.AddHours(10), true, "1"); TicketForPremiumCrypted = FormsAuthentication.Encrypt(TicketForPremium); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName,
7
10212
by: cmrchs | last post by:
Hi, In Windows Vista: where does asp.net write its cookies? I use HttpCookie objCookie = new HttpCookie("nameCookie"); in Win2000 (and later) they used to be in C:\Documents and Settings\Administrator\Cookies but not anymore
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2974
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.