Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-05-2009
Member
 
Join Date: Jan 2009
Posts: 150
Problem with cookies in PHP

I am creating a website in PHP. I want to send a variable from a form.

Code:
<form id="form1" method="post" action="form_results.php">
I already tried some of the methods that I know like setcookie, and $cookie, but nothing works at all. Is it possible? Currently I am assuming that my IE is blocking the cookies.
Reply With Quote
  #2  
Old 07-05-2009
Member
 
Join Date: May 2008
Posts: 685
Re: Problem with cookies in PHP

You know that there are also sessions, if your data are not confidential.

Internet Explorer is not blocking cookies, I suppose, your code is rather poorly managed.

If you want help, we'll have to see what you have done, and also some information on what exactly is the problem. Show your code, it will help us to correct you at the right point.
Reply With Quote
  #3  
Old 07-05-2009
Member
 
Join Date: Jan 2009
Posts: 150
Re: Problem with cookies in PHP

First page
HTML Code:
<head> 
</head> 
<form action="command_verification_information.php" method="post"> 
<p> 
<label> mail Address: 
<input type="text" name="mail" /> 
</label> </p> 
<p> 
<label> Password: 
<input type="text" name="Password" /> 
</label> </p> 
<p> 
<input type="submit" name="submit" value="Send" /> 
<input name="reset" type="reset" /> value="Clear" 
<?php setcookie ('mail', $_POST ['mail'], time () +3600)?> 
</p> 
</form> 
</body> 
</html>
and

on the following pages where I retrieves the variable like this:
PHP Code:
<?php echo $_COOKIE ['username'];?>
Reply With Quote
  #4  
Old 07-05-2009
Member
 
Join Date: May 2008
Posts: 685
Re: Problem with cookies in PHP

setcookie sends headers and therefore must be called before any output (no text before the call).

Since you have not given the error message that PHP returns if you call after sending the text what you are getting, this is just an assumption.

If you get no error message, I suppose your server is misconfigured.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem with cookies in PHP"
Thread Thread Starter Forum Replies Last Post
Internet explorer 9 displays Cookies error message? IE9 works better when it is cookies enabled, please enable cookies? Bellare Technology & Internet 10 07-03-2012 09:41 AM
Google cookies does not obeys the cookies in Opera 10.51 Wild Kat Technology & Internet 3 26-02-2012 01:54 PM
Capital One Cookies Problem Techno01 Technology & Internet 3 20-08-2009 05:53 PM
Problem in Tracking Cookies Jagadamba Networking & Security 3 04-02-2009 01:24 PM
firefox browser cookies problem Emilia Technology & Internet 3 20-08-2008 06:28 PM


All times are GMT +5.5. The time now is 05:12 AM.