Forum Moderators: coopster
<?php
session_start();
if(<check for the user country here> )
$_SESSION['USER_COUNTRY'] = <user country>;
?>
<?php
if($_SESSION['USER_COUNTRY'] == 'UK')
// do something
?>
$countries = array(
"UK" => array(
"link" => "http://url",
"image" => "path-to-image/image.jpg"),
"US" => array(
"link" => "http://url2",
"image" => "path-to-image/image2.jpg")
);
foreach($countries as $country => $value){
echo "<option value='$country'>$country</option>";
}
setcookie( "USER_LOCATION", $<your php variable> ) ;
if (isset($_COOKIE['USER_LOCATION'])) {
$country = $_COOKIE['USER_LOCATION'];
$link = $countries[$country]["link"];
$image = $countries[$country]["image"];
// now you have the geo-specific link and image
}