php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21750 Setcookie with array
Submitted: 2003-01-19 10:42 UTC Modified: 2003-01-19 18:08 UTC
From: mitya at alesh dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.0 OS: Linux Red Hat
Private report: No CVE-ID: None
 [2003-01-19 10:42 UTC] mitya at alesh dot ru
Hi there!
When i trying to set cookie it doesn't works!
the code

while (list($key, $value) = each ($_GET["orderformresult"])) {
	if(empty($order[$key])){
		setcookie("order[".$key."]","");
		setcookie ("order[".$key."]",$value,time()+3600);
	}else{
		setcookie ("order[".$key."]",$value,time()+3600);

	}
}

So , the code is right, it works, but ONLY in that directory where the cookie was setted.  

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-19 18:08 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

If you want cookie to be set for directory other then current provide the path parameter to setcookie() as the 4th argument.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 15 00:00:03 2025 UTC