HTML Tutorial


 /help/HTML Help Forum   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Cookie problem? help
Post new topic   Reply to topic    HTML Help Forum -> Javascript
View previous topic :: View next topic  
Author Message
alexa-lol



Joined: 10 Mar 2006
Posts: 66

PostPosted: Fri Mar 10, 2006 5:49 am     Cookie problem? help Reply with quote

I dont know how to WRITE a cookie. I want that my cookie wuold remember which lenguage user chose. something like that

Select lenguege

Slovenian //this links to google.si
English //this links to google.com
Deutsch //this links to google.de




I wana that Cookie remembers this.
can anyone help me and write code, please Very Happy

and if can he do it with rollover image. IMAGE1_OUT.jpg and IMAGE2_over for Slovenian lenguage etc.

help, I am newbi at this Very Happy(site building)
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

PostPosted: Fri Mar 10, 2006 7:36 am     Reply with quote

What server side language do you use?

_________________
Corey
Loud Commerce | Loud Worx | Toll Free Solutions
alexa-lol



Joined: 10 Mar 2006
Posts: 66

PostPosted: Fri Mar 10, 2006 8:21 am     Reply with quote

I dont know.
alexa-lol



Joined: 10 Mar 2006
Posts: 66

PostPosted: Fri Mar 10, 2006 8:24 am     Reply with quote

I am going to install Linux Fedora Core 4 and then i will install what i am going to need? what do you recomend, I wanna to have that on my WebSite:

-html
+what i will need

and that is all


I am newbi at SiteBuilding, i am better at C++ and other stuff Very Happy
degsy



Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK

PostPosted: Fri Mar 10, 2006 9:21 am     Reply with quote

Here is an example of using a cookie in PHP

Code:

<?php
if(isset($_POST['Submit'])){
   
   $lang = isset($_POST['lang'])? $_POST['lang'] : 'en';
   $expire = strtotime("+5 years",time());
   $path = '/';
   $domain = '.domain.com'; // whatever your domain name is
   setcookie("lang", $lang, $expire, $path, $domain);
   header("Location: " . $_SERVER['PHP_SELF']);
}

if (isset($_COOKIE["lang"])){
   $lang = $_COOKIE['lang'];
   
   switch($lang){
      case 'en':
         $url = 'http://www.google.com';
      break;
      case 'fr':
         $url = 'http://www.google.fr';
      break;
   }
   header("Refresh: 5; URL=" . $url);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
if (isset($_COOKIE["lang"])){
echo "You are set to " . $_COOKIE["lang"] . "!<br />Please wait while you are redirected";
}
else{
echo "No cookie set<br />";
}
?>
<form id="form1" name="form1" method="post" action="">
  <p>
    <label>
      <input type="radio" name="lang" value="en" <?php ($lang == 'en')? print 'checked="checked"' : print ''; ?>/>
      English</label>
    <br />
    <label>
      <input type="radio" name="lang" value="fr"  <?php ($lang == 'fr')? print 'checked="checked"' : print ''; ?>/>
      French</label>
    <br />
    <input type="submit" name="Submit" value="Submit" />
  </p>
</form>
</body>
</html>
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

PostPosted: Fri Mar 10, 2006 9:24 am     Reply with quote

I only deal with Windows and ASP but you will probably use PHP on a *NIX box - check out setcookie, Basics of Setting Cookies with PHP, Introduction to PHP Programming - A 4 Day Course, and Using Cookies in PHP

_________________
Corey
Loud Commerce | Loud Worx | Toll Free Solutions
alexa-lol



Joined: 10 Mar 2006
Posts: 66

PostPosted: Fri Mar 10, 2006 10:25 am     Reply with quote

ok good. tnx degsy.

1
Have you got any ideas how would i write this:
BACKGROUND
LENGUAGE BUTTONS->
->behind every Lenguage button a link to country site, and cookie which would memorise which country has USER selected and would Automaticly redirect him to country site

is this possible?
if it isnt, I have another idea

2

LOADING SCREEN


loading # # # # # 100%



and in this LOADING SCREEN there would be command to look at cookie?

bye


Last edited by alexa-lol on Fri Mar 10, 2006 11:34 am; edited 1 time in total
degsy



Joined: 23 Feb 2005
Posts: 2440
Location: North East, UK

PostPosted: Fri Mar 10, 2006 10:37 am     Reply with quote

If you want to use a link then change the $_POST to $_GET and use a query string.

e.g. http://www.domain.com/page.php?lang=en
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8748
Location: Castle Pines North, CO USA

PostPosted: Fri Mar 10, 2006 11:26 am     Reply with quote

alexa-lol wrote:
ROLLOVER IMAGE
Please don't triple post

How to tell the Image where it should be(x,y)

Simple Rollover-HTML, please

This prevents others from knowing what was already told to you

_________________
Corey
Loud Commerce | Loud Worx | Toll Free Solutions
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum -> Javascript All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial