On 19 December 2003 01:27, Cesar Aracena wrote: > Hi all, > > I have an issue here. I'm making a english/spanish site and want the > browser to remember their preference with a cookie. The first time a > visitor comes into the site, they will be taken to the english part > (www.site.com/eng/) and when someone clicks over the "Spanish" link, > I want the cookie that was setled to be erased and a new one to be > placed instead. The thing is that is being done in two separate files > because the problem with headers (one for deleting the cookie and the > other to place the new one). The script I have (pretty mesy) doesn't > erase the cookie OR places the same one over again instead of placing > the new one. Here's what I've got so far: > > THE MAIN INDEX PAGE: > > <? > if (isset($_COOKIE['Languange'])) > { > $relative_url = $_COOKIE['Language']; > header("Location: http://localhost/icaam10/".$relative_url); } > elseif(!isset($_COOKIE['Languange']) AND !isset($lan)) { > $value = "eng"; > setcookie ("Language", $value, time()+31536000); > header("Location: http://localhost/icaam10/eng"); > } > elseif(!isset($_COOKIE['Languange']) AND isset($lan)) { > $value = $lan; > setcookie ("Language", $value, time()+31536000); > header("Location: http://localhost/icaam10/".$value); > }
Just at a quick glance, you've got 3 occurrences of 'Language' and 2 occurrences of 'Languange' (with an extra 'n'). Fix these to all be 'Language', try it again, and come back here if you've still got problems. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php