{"id":50755,"date":"2020-11-04T03:01:03","date_gmt":"2020-11-03T17:01:03","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=50755"},"modified":"2020-11-03T11:57:34","modified_gmt":"2020-11-03T01:57:34","slug":"php-city-guess-country-game-geodata-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-geodata-tutorial\/","title":{"rendered":"PHP City Guess Country Game Geodata Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Geodata Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/more_hint.jpg\" title=\"PHP City Guess Country Game Geodata Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Geodata Tutorial<\/p><\/div>\n<p>Think &#8220;where&#8221;, think &#8220;geodata&#8221;.  And with this in mind, today&#8217;s improvements on yesterday&#8217;s <a title='PHP City Guess Country Game Massaging Tutorial' href='#phpcgcgmt'>PHP City Guess Country Game Massaging Tutorial<\/a> is to, where it is available in the chain of data sources the City Guess Quiz web application accepts, if there is &#8230;<\/p>\n<ul>\n<li>geodata present &#8230; then offer the user &#8230;<\/li>\n<li>a hint mechanism<\/li>\n<\/ul>\n<p> &#8230; in our case that being an &#8230;<\/p>\n<ul>\n<li>&#10067; &#8220;a&#8221; link &#8230; to &#8230;<\/li>\n<li>creation of an HTML iframe call to our <a target=_blank href='https:\/\/developers.google.com\/chart\/interactive\/docs\/index' title='Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.'>Google Chart<\/a> <a target=_blank href='https:\/\/developers.google.com\/chart\/interactive\/docs\/gallery\/geochart' title='Google Geo Charts'>Geo Chart<\/a> interfacing in its &#8230;<\/p>\n<ul>\n<li>Latitude, Longitude mode of use &#8230; rather than &#8230;<\/li>\n<li>Country (or Region) name mode of use<\/li>\n<\/ul>\n<p> &#8230; for the fairly obvious reason that we don&#8217;t want to make the quiz too easy!<\/p>\n<p>It&#8217;s a combination of PHP and (PHP writing out) Javascript that help make this &#8220;hint&#8221; functionality possible &#8230;<\/p>\n<table style=width:100%;>\n<tr>\n<th>Before any HTML, in PHP <font color=blue>gathering together relevant geodata<\/font>, where existant &#8230;<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php<br \/>\n<code><br \/>\n   $alturlis=\"\/\/www.rjmprogramming.com.au\/PHP\/GeoChart\/geo_chart.php?title=CITYGOESHERE&onclick=y&width=149&height=97&country=City&popularity=Intensity&aregeographicals=y&guess=&data=%20[LAT|LONG|~CITYGOESHERE~,1]%20\";<br \/>\n<br \/>\nif (strpos(strtolower($ourfilename), \".csv\") !== false) { \/\/ thanks to https:\/\/simplemaps.com\/data\/world-cities<br \/>\n\/\/ \"city\",\"city_ascii\",\"lat\",\"lng\",\"country\",\"iso2\",\"iso3\",\"admin_name\",\"capital\",\"population\",\"id\"<br \/>\n\/\/ \"Tokyo\",\"Tokyo\",\"35.6897\",\"139.6922\",\"Japan\",\"JP\",\"JPN\",\"T\u014dky\u014d\",\"primary\",\"37977000\",\"1392685764\"<br \/>\n\/\/ \"Jakarta\",\"Jakarta\",\"-6.2146\",\"106.8451\",\"Indonesia\",\"ID\",\"IDN\",\"Jakarta\",\"primary\",\"34540000\",\"1360771077\"<br \/>\n<br \/>\n       \/\/echo strtolower($ourfilename) . \"\\n\";<br \/>\n $fchunk=data_unify($fchunk);<br \/>\n $bits=explode(\"\\n\", $fchunk);<br \/>\n $hbit=str_replace('\"','',strtolower($bits[0]));<br \/>\n $hbits=explode(\",\", $hbit);<br \/>\n $citycol=-1;<br \/>\n $countrycol=-1;<br \/>\n $isocol=-1;<br \/>\n <font color=blue>$latcol=-1;<br \/>\n $longcol=-1;<br \/>\n $latis=\"\";<br \/>\n $longis=\"\";<\/font><br \/>\n if (strpos((\",\" . $hbit . \",\"), \",city\") !== false && strpos((\",\" . $hbit . \",\"), \",country\") !== false && strpos($hbit, \",\") !== false) {<br \/>\n for ($i=0; $i&lt;sizeof($hbits); $i++) {<br \/>\n   if ($citycol == -1 && strpos($hbits[$i], \"city\") !== false) {<br \/>\n     $citycol=$i;<br \/>\n   } else if ($countrycol == -1 && strpos($hbits[$i], \"country\") !== false) {<br \/>\n     $countrycol=$i;<br \/>\n   } else if ($isocol == -1 && strpos($hbits[$i], \"iso\") !== false) {<br \/>\n     $isocol=$i;<br \/>\n   }<br \/>\n   <font color=blue>if ($latcol == -1 && substr(($hbits[$i] . \"   \"),0,3) ==  \"lat\") {<br \/>\n     $latcol=$i;<br \/>\n     if (substr(($hbits[1 + $i] . \"   \"),0,1) == \"l\") {<br \/>\n       $longcol=(1 + $i);<br \/>\n     } else if (substr(($hbits[-1 + $i] . \"   \"),0,1) == \"l\") {<br \/>\n       $longcol=(-1 + $i);<br \/>\n     }<br \/>\n   }<\/font><br \/>\n }<br \/>\n if ($citycol &gt;=0 && $countrycol &gt;= 0) {<br \/>\n for ($i=1; $i&lt;sizeof($bits); $i++) {<br \/>\n  if ($longcol &gt;= 0 && $latcol &gt;= 0) {<br \/>\n  $latis=\"|\" . str_replace('\"','',explode(\",\",$bits[$i])[$latcol]) . \",\";<br \/>\n  $longis=str_replace('\"','',explode(\",\",$bits[$i])[$longcol]);<br \/>\n  }<br \/>\n  if (substr(str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]),0,1) &gt;= \"A\") {<br \/>\n  if (substr($bits[$i],0,1) == '\"') {<br \/>\n  $citiesarr[sizeof($citiesarr)]=str_replace('\"','',explode('\",\"',$bits[$i])[$citycol])<font color=blue> . $latis . $longis<\/font>;<br \/>\n  } else {<br \/>\n  $citiesarr[sizeof($citiesarr)]=explode(\",\",$bits[$i])[$citycol]<font color=blue> . $latis . $longis<\/font>;<br \/>\n  }<br \/>\n  if (substr($bits[$i],0,1) == '\"') {<br \/>\n  $countriesarr[sizeof($countriesarr)]=str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]);<br \/>\n  } else {<br \/>\n  $countriesarr[sizeof($countriesarr)]=explode(\",\",$bits[$i])[$countrycol];<br \/>\n  }<br \/>\n  if ($isocol &gt;= 0) {<br \/>\n    if (substr($bits[$i],0,1) == '\"') {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=getih(str_replace('\"','',explode(\",\",$bits[$i])[$isocol]));<br \/>\n    } else {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=getih(explode(\",\",$bits[$i])[$isocol]);<br \/>\n    }<br \/>\n  } else {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=trim(\"  \");<br \/>\n  }<br \/>\n  if (!strstr($uniquecountries, \",\" . urlencode(str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . \",\") && !strstr($uniquecountries, \",\" . urlencode(str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . \",\")) {<br \/>\n   $uniquecountries .= urlencode(str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . \",\";<br \/>\n \/\/echo str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]) . \"\\n\";<br \/>\n  }<br \/>\n<br \/> <br \/>\n  $countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];<br \/>\n  $countriesisotwo[-1 + sizeof($countriesisotwo)]='';<br \/>\n  }<br \/>\n }<br \/>\n }<br \/>\n }<br \/>\n         }<br \/>\n<br \/>\n         \/\/$outxml.=$outd . $ourfilename . \"@!@!@\" . str_replace(\"'\", \"' + String.fromCharCode(39) + '\", str_replace( \"\\r\", \" \", str_replace(\"\\n\",\" \",str_replace('&lt;','&lt;',str_replace('&gt;','&gt;',$isc)))));<br \/>\n         \/\/$outxml.=$outd . $ourfilename . \"@!@!@\" . $fchunk;<br \/>\n         \/\/$outd=\"!@!@!\";<br \/>\n        }<br \/>\n       }<br \/>\n      }<br \/>\n      zip_close($zip);<br \/>\n      $zip=null;<br \/>\n     }<br \/>\n \/\/echo \"1:\" . sizeof($countriesarr) . \"\\n\";<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;\n<\/td>\n<\/tr>\n<tr>\n<th>Flagging the Cities dropdown (for internal use only) with <font color=blue>global data attribute<\/font> regarding the geodata &#8230;<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\nfunction notshowucities() {<br \/>\n global $citiesarr, $countriesarr<font color=blue>, $alturlis<\/font>;<br \/>\n $thisurlis=\"\";<br \/>\n $ret=\"&lt;select name='ucity' id='ucity' style='display:none;'&gt;&lt;\/select&gt;\";<br \/>\n \/\/echo \"\" . sizeof($countriesarr) . \"\\n\";<br \/>\n $zerois=0;<br \/>\n $oneinc=1;<br \/>\n $ii=0;<br \/>\n if (sizeof($countriesarr) &gt; 1000) {  $oneinc=floor(sizeof($countriesarr) \/ 1000); $zerois=rand(0,994); }<br \/>\n for ($i=$zerois; $i&lt;sizeof($countriesarr); $i+=$oneinc) {<br \/>\n   <font color=blue>if (strpos($citiesarr[$i], \"|\") !== false) { \/\/ geodata there<br \/>\n   $thisurlis=\" data-hinturl='\" . str_replace('CITYGOESHERE', urlencode(explode(\"|\",$citiesarr[$i])[0]), str_replace('LAT', explode(\",\",explode(\"|\",$citiesarr[$i])[1])[0], str_replace('LONG', explode(\",\",explode(\"|\",$citiesarr[$i])[1])[1], $alturlis))) . \"'\";<br \/>\n   $ret=str_replace(\"&lt;\/select&gt;\", \"&lt;option id='o\" . $i . \"'\" . $thisurlis . \" value='\" . (explode(\"|\",$citiesarr[$i])[0]) . \"'&gt;\" . ($countriesarr[$i]) . \"&lt;\/option&gt;&lt;\/select&gt;\", $ret);<br \/>\n   } else {<\/font><br \/>\n   $ret=str_replace(\"&lt;\/select&gt;\", \"&lt;option id='o\" . $i . \"' value='\" . ($citiesarr[$i]) . \"'&gt;\" . ($countriesarr[$i]) . \"&lt;\/option&gt;&lt;\/select&gt;\", $ret);<br \/>\n   <font color=blue>}<\/font><br \/>\n   $ii++;<br \/>\n }<br \/>\n return $ret;<br \/>\n}<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;\n<\/td>\n<\/tr>\n<tr>\n<th>Initial HTML <font color=blue>new div<\/font> set aside for &#8220;hint&#8221; content &#8230;<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n&lt;h3 style='color: white;' id='score' align='center'&gt;Score: \" . $escore . \" Goes: \" . $egoes . \"<font color=blue> &lt;div style=display:inline-block; id=dhint&gt;&lt;\/div&gt;<\/font>&lt;\/h3&gt;&lt;br&gt;<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<\/p>\n<tr>\n<th>Formulating the next question (and onto user usage) logic <font color=blue>changes<\/font> &#8230;<\/th>\n<\/tr>\n<tr>\n<td>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n function getnext() {<br \/>\n if (navigator.userAgent.match(\/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile\/i)) {<br \/>\n document.getElementById('ucountry').style.fontSize='24px';<br \/>\n }<br \/>\n if (document.getElementById('bemail')) {<br \/>\n document.getElementById('bemail').style.display='inline-block';<br \/>\n }<br \/>\n if (!oucity) {<br \/>\n oucity=document.getElementById('ucity');<br \/>\n }<br \/>\n var rnum=lastg;<br \/>\n while (rnum == lastg) {<br \/>\n rnum=Math.floor(Math.random() * numc);<br \/>\n if (!document.getElementById('o' + rnum)) { rnum=lastg;    }<br \/>\n } \\n<br \/>\n lastg=rnum;<br \/>\n var ois=document.getElementById('o' + rnum); \\n<br \/>\n document.getElementById('ucity').value=ois.value; \\n<br \/>\n lcity=ois.value; \\n<br \/>\n document.getElementById('thcountry').innerHTML='Country';<br \/>\n document.getElementById('thiscity').value=ois.value;<br \/>\n document.getElementById('thiscity').title=ois.value;<br \/>\n document.getElementById('thcity').innerHTML='City&lt;br&gt;&lt;font size=1&gt;' + ois.value + '&lt;\/font&gt;';<br \/>\n ccountry=ois.innerHTML;<br \/>\n <font color=blue>if (('' + ois.getAttribute('data-hinturl')).replace(\/^null$\/g,'').replace(\/\\+\/g,' ') != '') {<br \/>\n   document.getElementById('dhint').innerHTML='&nbsp;&lt;a id=hinta onclick=\\\"iframehint(' + \\\"'\\\" + ('' + ois.getAttribute('data-hinturl')) + \\\"'\\\" + ');\\\" style=display:inline-block;cursor:pointer;text-decoration:none; title=Hint&gt;&amp;#10067;&lt;\/a&gt;';<br \/>\n } else {<br \/>\n   document.getElementById('dhint').innerHTML='';<br \/>\n }<\/font><br \/>\n gethtmlready(ois.value); \\n<br \/>\n } \\n<br \/>\n <font color=blue>function iframehint(oisgetAttributedatahinturl) {<br \/>\n   document.getElementById('dhint').innerHTML='&lt;iframe id=hinti src=' + oisgetAttributedatahinturl + ' style=height:214px;display:inline-block;&gt;&lt;\/iframe&gt;';<br \/>\n }<\/font> \\n<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;\n<\/td>\n<\/tr>\n<\/table>\n<p>Again, we hope the use of <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php-------GETME\" title=\"city_guess.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php-------GETME\" title=\"city_guess.php\">city_guess.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">City Guess Country game<\/a> in action is now endowed with some empathy for the geographically challenged non-masochists of the <strike>world<\/strike>woooooooorrrrrrllllllllld!<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-geodata-tutorial\/'>PHP City Guess Country Game Geodata Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcgcgmt'>Previous relevant <a target=_blank title='PHP City Guess Country Game Massaging Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-massaging-tutorial\/'>PHP City Guess Country Game Massaging Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Massaging Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/more_data_massaging.jpg\" title=\"PHP City Guess Country Game Massaging Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Massaging Tutorial<\/p><\/div>\n<p>To improve on the progress up until yesterday&#8217;s <a title='PHP City Guess Country Game Keyboard Tutorial' href='#phpcgcgkt'>PHP City Guess Country Game Keyboard Tutorial<\/a> today, we turn our attention to both &#8230;<\/p>\n<ul>\n<li>the intricacies and complications of Country names regarding multiple data sources (not all with an ISO 2 character code to lean on) &#8230; as well as &#8230;<\/li>\n<li>the intricacies and complications of what a user feels comfortable typing in with the keyboard regarding Country names (causing yesterday&#8217;s &#8220;function okp&#8221; to <font color=blue>become considerably more complex<\/font>) as per &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n function okp(event) {<br \/>\n    var optl=[], joptl=0, jdone=false, findings='', findingsd='', lendiff='', lendiffd=''<font color=blue>, pfix='', ppfix='', ppdo=true<\/font>;<br \/>\n    completefinding='';<br \/>\n    if (event.keyCode &gt;= 65 && event.keyCode &lt;= 90) {<br \/>\n      kbsofar+=String.fromCharCode(event.keyCode);<br \/>\n      <font color=blue>if ((kbsofar + '     ').toLowerCase().substring(0,2) == 'ko' && (kbsofar + '     ').toLowerCase().substring(0,3) != 'kos') { pfix='korea'; if (kbsofar.toLowerCase().replace('n','d').indexOf('d') != -1) {  pfix='north korea'; kbsofar=pfix;    } else if (kbsofar.toLowerCase().replace('s','r').replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='south korea'; kbsofar=pfix;    } }<br \/>\n      if ((kbsofar + '     ').toLowerCase().substring(0,3) == 'con') { pfix='congo'; if (kbsofar.toLowerCase().indexOf('d') != -1) {  pfix='democratic republic of the congo';  } else if (kbsofar.toLowerCase().replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='the republic of the congo';  } }<\/font><br \/>\n      \/\/document.title=kbsofar;<br \/>\n      if (kbsofar.length == 2 && kbsofar == kbsofar.toUpperCase()) {<br \/>\n        optl=document.getElementsByTagName('option');<br \/>\n        for (joptl=1; joptl&lt;optl.length; joptl++) {<br \/>\n          if (('' + optl[joptl].getAttribute('data-iso')) == kbsofar && !jdone) {<br \/>\n            <font color=blue>ppdo=false;<\/font><br \/>\n            \/\/alert(optl[joptl].outerHTML);<br \/>\n            jdone=true;<br \/>\n            document.getElementById('ucountry').value=optl[joptl].value;<br \/>\n            notc=' (not ' + optl[joptl].innerHTML + ')';<br \/>\n            picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));<br \/>\n            kbsofar='';<br \/>\n          }<br \/>\n        }<br \/>\n      } <font color=blue>\/\/ <\/font>else {<br \/>\n      <font color=blue>if (ppdo) {<\/font><br \/>\n        <font color=blue>if ((kbsofar + '     ').toLowerCase().substring(0,2) == 'ko' && (kbsofar + '     ').toLowerCase().substring(0,3) != 'kos') { pfix='korea'; if (kbsofar.toLowerCase().replace('n','d').indexOf('d') != -1) {  pfix='north korea';  kbsofar=pfix;    } else if (kbsofar.toLowerCase().replace('s','r').replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='south korea'; kbsofar=pfix;    } }<br \/>\n        if ((kbsofar + '     ').toLowerCase().substring(0,3) == 'con') { pfix='congo'; if (kbsofar.toLowerCase().indexOf('d') != -1) {  pfix='democratic republic of the congo'; kbsofar=pfix;   } else if (kbsofar.toLowerCase().replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='the republic of the congo'; kbsofar=pfix;   } }<\/font><br \/>\n        optl=document.getElementsByTagName('option');<br \/>\n        for (joptl=1; joptl&lt;optl.length; joptl++) {<br \/>\n          <font color=blue>if (pfix != '' && optl[joptl].value.toLowerCase().indexOf('hong kong') == -1) { if (('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) &gt;= 0) { ppfix=pfix; if (pfix != 'congo' && pfix != 'korea') { kbsofar=pfix;  } } else { ppfix=''; }   } <\/font><br \/>\n          if (optl[joptl].value != '' && (<font color=blue>ppfix<\/font> + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-iso') != -1) {<br \/>\n            <font color=blue>if (pfix.toLowerCase().indexOf(' congo') != -1 || pfix.toLowerCase().indexOf(' korea') != -1) {<br \/>\n              if (completefinding == '') {<br \/>\n                completefinding=optl[joptl].value;<br \/>\n              } else {<br \/>\n                completefinding=' ';<br \/>\n              }<br \/>\n            } else {<\/font><br \/>\n            lendiff+=lendiffd + eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length));<br \/>\n            lendiffd=',';<br \/>\n            if (eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length)) &lt;= 4) {<br \/>\n              if (completefinding == '') {<br \/>\n                completefinding=optl[joptl].value;<br \/>\n              } else {<br \/>\n                completefinding=' ';<br \/>\n              }<br \/>\n            }<br \/>\n            <font color=blue>}<\/font><br \/>\n            findings+=findingsd + optl[joptl].value;<br \/>\n            findingsd=',';<br \/>\n          }<br \/>\n        }<br \/>\n        if (findings == '') {<br \/>\n        document.getElementById('oneopt').innerHTML='Please select Country ...';<br \/>\n        <font color=blue>document.getElementById('thcountry').innerHTML='Country';<\/font><br \/>\n        kbsofar='';<br \/>\n        } else if (findings.indexOf(',') != -1) {<br \/>\n        document.getElementById('oneopt').innerHTML=findings;<br \/>\n        document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0] + ' ... ' + findings;<br \/>\n        <font color=blue>document.getElementById('thcountry').innerHTML='Country&lt;br&gt;&lt;font size=1&gt;' + findings + '&lt;\/font&gt;'; <\/font><br \/>\n        \/\/document.title=lendiff + ' .... ' + completefinding;<br \/>\n        if (completefinding.trim() != '') {<br \/>\n          setTimeout(dodecide,2000);<br \/>\n        }<br \/>\n        } else {<br \/>\n            document.getElementById('ucountry').value=findings;<br \/>\n            notc=' (not ' + findings + ')';<br \/>\n            picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));<br \/>\n            kbsofar='';<br \/>\n            \/\/ location.href='#cgcform';<br \/>\n        }<br \/>\n      }<br \/>\n    } else if ((event.keyCode &gt;= 97 && event.keyCode &lt;= 122) || event.keyCode == 32) {<br \/>\n      kbsofar+=String.fromCharCode(event.keyCode);<br \/>\n        <font color=blue>if ((kbsofar + '     ').toLowerCase().substring(0,2) == 'ko' && (kbsofar + '     ').toLowerCase().substring(0,3) != 'kos') { pfix='korea'; if (kbsofar.toLowerCase().replace('n','d').indexOf('d') != -1) {  pfix='north korea';  kbsofar=pfix;    } else if (kbsofar.toLowerCase().replace('s','r').replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='south korea';  kbsofar=pfix;   } }<br \/>\n        if ((kbsofar + '     ').toLowerCase().substring(0,3) == 'con') { pfix='congo'; if (kbsofar.toLowerCase().indexOf('d') != -1) { pfix='democratic republic of the congo'; kbsofar=pfix;  } else if (kbsofar.toLowerCase().replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='the republic of the congo';  kbsofar=pfix;   } }<\/font><br \/>\n        optl=document.getElementsByTagName('option');<br \/>\n        for (joptl=1; joptl&lt;optl.length; joptl++) {<br \/>\n          <font color=blue>if (pfix != '' && optl[joptl].value.toLowerCase().indexOf('hong kong') == -1) { if (('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) &gt;= 0) { ppfix=pfix;  if (pfix != 'congo' && pfix != 'korea') {   kbsofar=pfix;  } } else { ppfix=''; }   } <\/font><br \/>\n          if (optl[joptl].value != '' && (<font color=blue>ppfix<\/font> + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-') != -1) {<br \/>\n            <font color=blue>if (pfix.toLowerCase().indexOf(' congo') != -1 || pfix.toLowerCase().indexOf(' korea') != -1) {<br \/>\n              if (completefinding == '') {<br \/>\n                completefinding=optl[joptl].value;<br \/>\n              } else {<br \/>\n                completefinding=' ';<br \/>\n              }<br \/>\n            } else {<\/font><br \/>\n            lendiff+=lendiffd + eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length));<br \/>\n            lendiffd=',';<br \/>\n            if (eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length)) &lt;= 4) {<br \/>\n              if (completefinding == '') {<br \/>\n                completefinding=optl[joptl].value;<br \/>\n              } else {<br \/>\n                completefinding=' ';<br \/>\n              }<br \/>\n            }<br \/>\n            <font color=blue>}<\/font><br \/>\n            findings+=findingsd + optl[joptl].value;<br \/>\n            findingsd=',';<br \/>\n          }<br \/>\n        }<br \/>\n        if (findings == '') {<br \/>\n        document.getElementById('oneopt').innerHTML='Please select Country ...';<br \/>\n        <font color=blue>document.getElementById('thcountry').innerHTML='Country';<\/font><br \/>\n        kbsofar='';<br \/>\n        } else if (findings.indexOf(',') != -1) {<br \/>\n        document.getElementById('oneopt').innerHTML=findings;<br \/>\n        document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0] + ' ... ' + findings;<br \/>\n        <font color=blue>document.getElementById('thcountry').innerHTML='Country&lt;br&gt;&lt;font size=1&gt;' + findings + '&lt;\/font&gt;'; <\/font><br \/>\n        \/\/document.title=lendiff + ' ... ' + completefinding;<br \/>\n        if (completefinding.trim() != '') {<br \/>\n          setTimeout(dodecide,2000);<br \/>\n        }<br \/>\n        } else {<br \/>\n            document.getElementById('ucountry').value=findings;<br \/>\n            notc=' (not ' + findings + ')';<br \/>\n            picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));<br \/>\n            kbsofar='';<br \/>\n            \/\/ location.href='#cgcform';<br \/>\n        }<br \/>\n    }<br \/>\n    return false;<br \/>\n}<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;\n<\/li>\n<\/ul>\n<p> &#8230; work you might want to categorize as &#8220;data <i>massaging<\/i>&#8220;.  The (code) bother here (about Country Names) teaches us some database design principles.  Be happy to use a <i>Country ISO 2 character Code<\/i> as a good index, but never Country Names.  Generally speaking, numeric indexes are far better and more efficient than character based indexes (of a length even greater than one).<\/p>\n<p>How did we know we were getting anywhere piecing together our new PHP &#8220;data <i>massaging<\/i>&#8221; function &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\nfunction data_unify($what) {<br \/>\n  \/\/$what=str_replace(' \"', '\"', $what);<br \/>\n  \/\/$what=str_replace(\"<\", \" <\", $what);\n  $what=str_replace(\"Saint Helena, Ascension, And Tristan Da Cunha\", \"Saint Helena and Ascension and Tristan Da Cunha\", $what);\n  $what=str_replace(\" And \", \" and \", $what);\n  $what=str_replace(\" and the \", \" and The \", $what);\n  $what=str_replace(\"South Georgia and The South Sandwich Islands\", \"South Georgia and South Sandwich Islands\", $what);\n  $what=str_replace(\"Congo, The Democratic Republic of\", \"Democratic Republic of the Congo\", $what);\n  $what=str_replace(\"Congo, The Republic of\", \"The Republic of the Congo\", $what);\n  $what=str_replace(\"Congo (Kinshasa)\", \"Democratic Republic of the Congo\", $what);\n  $what=str_replace(\"Congo (Brazzaville)\", \"The Republic of the Congo\", $what);\n  $what=str_replace(\"Cote D'Ivoire\", \"C\u00f4te D\u2019Ivoire\", $what);\n  $what=str_replace(\"Ivory Coast\", \"C\u00f4te D\u2019Ivoire\", $what);\n  $what=str_replace(\"Bahamas, The\", \"Bahamas\", $what); \n  $what=str_replace(\"Gambia, The\", \"Gambia\", $what); \n  $what=str_replace(\"The Bahamas\", \"Bahamas\", $what); \n  $what=str_replace(\"The Gambia\", \"Gambia\", $what); \n  $what=str_replace(\"Moldova, Republic of\",\"Moldova\", $what);\n  $what=str_replace(\"Iran, Islamic Republic of\",\"Iran\", $what);\n  $what=str_replace(\"Brunei Darussalam\", \"Brunei\", $what); \n  $what=str_replace(\"Lao People's Democratic Republic\", \"Laos\", $what);\n  $what=str_replace(\"Lao PDR\",\"Laos\",$what);\n  $what=str_replace(\"Tanzania, United Republic of\",\"Tanzania\",$what);\n  $what=str_replace(\"Iran, Islamic Republic of\",\"Iran\",$what);\n  $what=str_replace(\"Macedonia, the Former Yugoslav Republic of\",\"Macedonia\",$what);\n  $what=str_replace(\"Korea, Democratic People's Republic of\",\"North Korea\",$what);\n  $what=str_replace(\"Korea, Republic of\",\"South Korea\",$what);\n  $what=str_replace(\"Korea, North\",\"North Korea\",$what);\n  $what=str_replace(\"Korea, South\",\"South Korea\",$what);\n  $what=str_replace(\"Korea (North)\",\"North Korea\",$what);\n  $what=str_replace(\"Korea (South)\",\"South Korea\",$what);\n  $what=str_replace(\"Libyan Arab Jamahiriya\",\"Libya\",$what);\n  $what=str_replace(\"Micronesia, Federated States of\", \"Micronesia\", $what);\n  $what=str_replace(\"Micronesia, Federated States Of\", \"Micronesia\", $what);\n  $what=str_replace(\"East Timor\", \"Timor-Leste\", $what);\n  $what=str_replace(\"Russian Federation\",\"Russia\",$what);\n  $what=str_replace(\"Syrian Arab Republic\",\"Syria\",$what);\n  $what=str_replace(\"Netherlands Antilles\",\"Netherlands\",$what);\n  $what=str_replace(\"United States Minor Outlying Islands\", \"United States\", $what);\n  $what=str_replace(\"Palestinian Territory\",\"Palestine\", $what);\n  $what=str_replace(\"West Bank\",\"Palestine\", $what);\n  $what=str_replace(\"Virgin Islands, U.S.\",\"United States\", $what);\n  $what=str_replace(\"Virgin Islands, British\",\"United Kingdom\", $what);\n<br \/>\n  return $what;<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p> &#8230; and &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\n$ctyisotwo=file_get_contents(\"http:\/\/www.nationsonline.org\/oneworld\/country_code_list.htm\");<br \/>\n$ctyisotwo=str_replace(\"Lao PDR\",\"Laos\",$ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Tanzania<\/a>, United Republic of\",\"Tanzania<\/a>\",$ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Iran, Islamic Republic of\",\"Iran\",$ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Macedonia, the Former Yugoslav Republic of\",\"Macedonia\",$ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Korea<\/a> (North)\",\"North Korea<\/a>\",$ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Korea<\/a> (South)\",\"South Korea<\/a>\",$ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Netherlands Antilles\",\"Netherlands\",$ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Micronesia, Federated States of\", \"Micronesia\", $ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Micronesia, Federated States Of\", \"Micronesia\", $ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"United States Minor Outlying Islands\", \"United States\", $ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Palestinian Territory\",\"Palestine\", $ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"West Bank\",\"Palestine\", $ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Virgin Islands, U.S.\",\"United States\", $ctyisotwo);<br \/>\n$ctyisotwo=str_replace(\"Virgin Islands, British\",\"United Kingdom\", $ctyisotwo);<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p>?  Well, the emoji flags would appear on the dropdown and in erroneous result prompt windows, and non-defined ones (such as &#8220;XW&#8221; ISO 2 character Code for &#8220;West Bank&#8221; (which we decided to map to &#8220;Palestine&#8221;) and &#8220;Netherlands Antilles&#8221; (ISO 2 character Code &#8220;AN&#8221;, which we decided to map to &#8220;Netherlands&#8221;)) would just show the two Regional Letter Code emojis rather than the flag.<\/p>\n<p>We hope the use of <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php------GETME\" title=\"city_guess.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php------GETME\" title=\"city_guess.php\">city_guess.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">City Guess Country game<\/a> in action is now a better and clearer user experience, as a result.  In this line of thinking, note, too, today, that with mobile platforms we&#8217;ve allowed more room for potential keyboards down the bottom of screens by nesting the H1 and H2 headers within a &#8220;<a target=_blank title='Reveal postings' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/reveal'>reveal<\/a>&#8221; starring <a target=_blank title='HTML details tag information from w3schools' href='https:\/\/www.w3schools.com\/tags\/tag_details.asp'>details<\/a>\/<a target=_blank title='HTML summary tag information from w3schools' href='https:\/\/www.w3schools.com\/tags\/tag_details.asp'>summary<\/a> &#8220;shrinkable&#8221; element pairing.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-massaging-tutorial\/'>PHP City Guess Country Game Massaging Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcgcgkt'>Previous relevant <a target=_blank title='PHP City Guess Country Game Keyboard Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-keyboard-tutorial\/'>PHP City Guess Country Game Keyboard Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Keyboard Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/more_keyboard.jpg\" title=\"PHP City Guess Country Game Keyboard Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Keyboard Tutorial<\/p><\/div>\n<p>Regarding yesterday&#8217;s <a title='PHP City Guess Country Game Zip Tutorial' href='#phpcgcgzt'>PHP City Guess Country Game Zip Tutorial<\/a>&#8216;s web application, like many others, most people would say there is available to them, input wise, and once they have started it up from the web browser address bar &#8230;<\/p>\n<ul>\n<li>mouse or touch input &#8230; and &#8230;<\/li>\n<li>keyboard input<\/li>\n<\/ul>\n<p> &#8230; modes of use, though with this particular web application, most people will just use their mouse or touchpad, we guess.  But bringing back a concept from the earlier &#8220;GUI desktop days&#8221; before the &#8220;online web days&#8221; it was an accessibility &#8220;badge of honour&#8221; to design programs that could be worked with both input modes above, or <i>either<\/i>.  And getting our web application work for <i>just keyboard<\/i> is easy enough by attaching &#8230;<\/p>\n<ul>\n<li>&#8220;onkeypress&#8221; event logic (return<font size=1>ing<\/font> <i>false<\/i>) to trap letters and space characters &#8230; &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n var completefinding='';<br \/>\n<br \/>\n function okp(event) {<br \/>\n    var optl=[], joptl=0, jdone=false, findings='', findingsd='', lendiff='', lendiffd='';<br \/>\n    completefinding='';<br \/>\n    if (event.keyCode &gt;= 65 && event.keyCode &lt;= 90) {<br \/>\n      kbsofar+=String.fromCharCode(event.keyCode);<br \/>\n      \/\/document.title=kbsofar;<br \/>\n      if (kbsofar.length == 2 && kbsofar == kbsofar.toUpperCase()) {<br \/>\n        optl=document.getElementsByTagName('option');<br \/>\n        for (joptl=1; joptl&lt;optl.length; joptl++) {<br \/>\n          if (('' + optl[joptl].getAttribute('data-iso')) == kbsofar && !jdone) {<br \/>\n            \/\/alert(optl[joptl].outerHTML);<br \/>\n            jdone=true;<br \/>\n            document.getElementById('ucountry').value=optl[joptl].value;<br \/>\n            notc=' (not ' + optl[joptl].innerHTML + ')';<br \/>\n            picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));<br \/>\n            kbsofar='';<br \/>\n          }<br \/>\n        }<br \/>\n      } else {<br \/>\n        optl=document.getElementsByTagName('option');<br \/>\n        for (joptl=1; joptl&lt;optl.length; joptl++) {<br \/>\n          if (optl[joptl].value != '' && ('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-') != -1) {<br \/>\n            lendiff+=lendiffd + eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length));<br \/>\n            lendiffd=',';<br \/>\n            if (eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length)) &lt;= 4) {<br \/>\n              if (completefinding == '') {<br \/>\n                completefinding=optl[joptl].value;<br \/>\n              } else {<br \/>\n                completefinding=' ';<br \/>\n              }<br \/>\n            }<br \/>\n            findings+=findingsd + optl[joptl].value;<br \/>\n            findingsd=',';<br \/>\n          }<br \/>\n        }<br \/>\n        if (findings == '') {<br \/>\n        document.getElementById('oneopt').innerHTML='Please select Country ...';<br \/>\n        kbsofar='';<br \/>\n        } else if (findings.indexOf(',') != -1) {<br \/>\n        document.getElementById('oneopt').innerHTML=findings;<br \/>\n        document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0] + ' ... ' + findings;<br \/>\n        \/\/document.title=lendiff + ' .... ' + completefinding;<br \/>\n        if (completefinding.trim() != '') {<br \/>\n          setTimeout(dodecide,2000);<br \/>\n        }<br \/>\n        } else {<br \/>\n            document.getElementById('ucountry').value=findings;<br \/>\n            notc=' (not ' + findings + ')';<br \/>\n            picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));<br \/>\n            kbsofar='';<br \/>\n            \/\/ location.href='#cgcform';<br \/>\n        }<br \/>\n      }<br \/>\n    } else if ((event.keyCode &gt;= 97 && event.keyCode &lt;= 122) || event.keyCode == 32) {<br \/>\n      kbsofar+=String.fromCharCode(event.keyCode);<br \/>\n        optl=document.getElementsByTagName('option');<br \/>\n        for (joptl=1; joptl&lt;optl.length; joptl++) {<br \/>\n          if (optl[joptl].value != '' && ('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-') != -1) {<br \/>\n            lendiff+=lendiffd + eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length));<br \/>\n            lendiffd=',';<br \/>\n            if (eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length)) &lt;= 4) {<br \/>\n              if (completefinding == '') {<br \/>\n                completefinding=optl[joptl].value;<br \/>\n              } else {<br \/>\n                completefinding=' ';<br \/>\n              }<br \/>\n            }<br \/>\n            findings+=findingsd + optl[joptl].value;<br \/>\n            findingsd=',';<br \/>\n          }<br \/>\n        }<br \/>\n        if (findings == '') {<br \/>\n        document.getElementById('oneopt').innerHTML='Please select Country ...';<br \/>\n        kbsofar='';<br \/>\n        } else if (findings.indexOf(',') != -1) {<br \/>\n        document.getElementById('oneopt').innerHTML=findings;<br \/>\n        document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0] + ' ... ' + findings;<br \/>\n        \/\/document.title=lendiff + ' ... ' + completefinding;<br \/>\n        if (completefinding.trim() != '') {<br \/>\n          setTimeout(dodecide,2000);<br \/>\n        }<br \/>\n        } else {<br \/>\n            document.getElementById('ucountry').value=findings;<br \/>\n            notc=' (not ' + findings + ')';<br \/>\n            picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));<br \/>\n            kbsofar='';<br \/>\n            \/\/ location.href='#cgcform';<br \/>\n        }<br \/>\n    }<br \/>\n    return <i>false<\/i>;<br \/>\n}<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; that <i>false<\/i> return <font color=green>meaning that your key presses have no effect<\/font> &#8230; and &#8230;<\/li>\n<li>&#8220;onkeydown&#8221; event logic to trap carriage returns &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n function crokp(event) {<br \/>\n     <font color=purple>if (event.keyCode == 13) {<br \/>\n        if (completefinding.trim() != '') {<br \/>\n            document.getElementById('ucountry').value=completefinding;<br \/>\n            notc=' (not ' + completefinding + ')';<br \/>\n            picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));<br \/>\n            kbsofar='';<br \/>\n            completefinding='';<br \/>\n            \/\/ location.href='#cgcform';<br \/>\n        }<\/font> else <font color=olive>if (document.getElementById('bemail')) {<br \/>\n        document.getElementById('bemail').click();<br \/>\n        }<\/font><br \/>\n     }<br \/>\n }<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; as a &#8220;bi-functionality&#8221; to be either a &#8230;<\/p>\n<ol>\n<li>user usage meaning that after entering &#8220;United States&#8221; (for instance) <font color=purple>the carriage return<\/font> settles for that rather than, say, &#8220;United States of America&#8221; &#8230; versus &#8230;<\/li>\n<li>a way to <font color=olive>programmatically click\/touch the &#8220;Email&#8221; button<\/font> <font size=1>(remembering our desire to be able to &#8220;just use keyboard&#8221; input)<\/font><\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p> &#8230; applied to the <font color=blue>document.body<\/font> element as per &#8230;<\/p>\n<p>&lt;?php echo &#8221;<br \/>\n<code><br \/>\n&lt;body <font color=blue>onkeydown='crokp(event);' onkeypress='return okp(event);' <\/font>style='background-color: olive;' onload='setTimeout(getnext,1000);'&gt;<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<\/p>\n<p> &#8230; but what about mobile platforms such as iOS iPhone or iPad?  Well, luckily there is one HTML input type=text element in our web application (whose inherit<font size=1>ance<\/font> relationship to document.body ensures it reaches the Javascript logic above)<\/font> for a mobile user to focus on to bring up the keyboard functionality <font size=1>(okay, we admit defeat with this &#8220;touch&#8221; action functionality needed, as iOS does not allow the HTML element <i>focus()<\/i> (programmatical) method)<\/font>.<\/p>\n<p>Also, it will not be that many web application where &#8230;<\/p>\n<blockquote><p>\n<font color=green>meaning that your key presses have no effect<\/font>\n<\/p><\/blockquote>\n<p> &#8230; is going to be a viable strategy.  Happily, with our City Country Quiz, it is a viable strategy with <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php-----GETME\" title=\"city_guess.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php-----GETME\" title=\"city_guess.php\">city_guess.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">City Guess Country game<\/a> in action, and how that extra keyboard functionality works.  For example, did you notice in the Javascript code way above how if &#8230;<\/p>\n<ol>\n<li>user enters two uppercase keyboard characters we look up all the ISO 2 character codes and accept any matches (as the user answer) &#8230; versus &#8230;<\/li>\n<li>any other characters go towards a left to right autocompletion feeling comma separated Country List being presented to the user until the specificity of the user characters weedles that list down to one (as the user user answer)<\/li>\n<\/ol>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-keyboard-tutorial\/'>New PHP City Guess Country Game Keyboard Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcgcgzt'>Previous relevant <a target=_blank title='PHP City Guess Country Game Zip Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-zip-tutorial\/'>PHP City Guess Country Game Zip Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Zip Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/more_zip_choices.jpg\" title=\"PHP City Guess Country Game Zip Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Zip Tutorial<\/p><\/div>\n<p>On top of the recent <a title='PHP City Guess Country Game Flag Emoji Tutorial' href='#phpcgcgfet'>PHP City Guess Country Game Flag Emoji Tutorial<\/a>&#8216;s progress today we allow for &#8230;<\/p>\n<ul>\n<li>zipped up XML data in the same format as &#8230;<\/li>\n<li>XML data files (as always) &#8230; and &#8230;<\/li>\n<li>zipped up CSV data thanks to the great <a target=_blank title='World Cities Database' href='https:\/\/simplemaps.com\/data\/world-cities'>World Cities Database<\/a> &#8230; who we would like to thank profusely<\/li>\n<\/ul>\n<p>Does this mean we can now reduce the inodes used by the web server and delete the original XML files?   Yes, because PHP has the wherewithal to read the data within the zip file and not need it to land on the web server disk, but <i>&#8220;no&#8221;, because<\/i> we want to look into the (new version lack of) speed and so have kept, for now (at least), a division of web application usage &#8230;<\/p>\n<table style='width:100%;' border=20>\n<tr>\n<th>Faster <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/\" title=\"Click picture\">original version<\/a> with less data available to choose from &#8230;<\/th>\n<\/tr>\n<tr>\n<td><iframe src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/\" style=\"width:100%;height:600px;\"><\/iframe><\/td>\n<\/tr>\n<tr>\n<th>Slower <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">new version<\/a> with more (zip derived) data available to choose from &#8230;<\/th>\n<\/tr>\n<tr>\n<td><iframe src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" style=\"width:100%;height:600px;\"><\/iframe><\/td>\n<\/tr>\n<\/table>\n<p> &#8230; via <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php----GETME\" title=\"city_guess.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php----GETME\" title=\"city_guess.php\">city_guess.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">City Guess Country game<\/a> in action, that extra zip file functionality PHP looking like &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\nforeach (glob(\"*.zip\") as $zipfile) {<br \/>\n     $zip = zip_open($zipfile);<br \/>\n     if ($zip) {<br \/>\n      $outxml=\" \";<br \/>\n      while ($zip_entry = zip_read($zip)) {<br \/>\n       $ourfilename=zip_entry_name($zip_entry);<br \/>\n       $regexpok=0;<br \/>\n       if (strpos($ourfilename, \"_MACOSX\/\") === false) {<br \/>\n        \/\/$regexp=\"\/^[\\S]\" . str_replace('[\\s\\S]?','[\\s\\S]*',str_replace('*','[\\s\\S]?',str_replace('?',',',str_replace('%',',',str_replace('.','[.]',$ofwhat))))) . \"$\/\";<br \/>\n        \/\/$regexpok=preg_match($regexp, explode(\"\/\",$ourfilename)[-1 + sizeof(explode(\"\/\",$ourfilename))]);<br \/>\n        $regexpok=1;<br \/>\n        if ($regexpok !== 0) {<br \/>\n         if ($outxml == \" \") { $outxml=\"\"; }<br \/>\n         $fchunk=zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));<br \/>\n<br \/> <br \/>\n         if (strpos(strtolower($ourfilename), \".xml\") !== false && strpos($fchunk, \"&lt;City&gt;\") !== false && strpos($fchunk, \"&lt;Country&gt;\") !== false) {<br \/>\n       \/\/echo strtoupper($ourfilename) . \"\\n\";<br \/>\n $bits=explode(\"&lt;City&gt;\", $fchunk);<br \/>\n for ($i=1; $i&lt;sizeof($bits); $i++) {<br \/>\n  $thistwobits=explode(\"&lt;\", $bits[$i]);<br \/>\n  $citiesarr[sizeof($citiesarr)]=$thistwobits[0];<br \/>\n  $thistwobits=explode(\"&lt;Country&gt;\", $bits[-1 + $i]);<br \/>\n  $thosetwobits=explode(\"&lt;\", $thistwobits[-1 + sizeof($thistwobits)]);<br \/>\n  $countriesarr[sizeof($countriesarr)]=$thosetwobits[0];<br \/>\n  if (strpos($ctyisotwo, \"&gt;\" . $thosetwobits[0]) !== false) {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=getih(trim(explode(\"&lt;\",explode('\"&gt;', explode(\"&gt;\" . $thosetwobits[0],$ctyisotwo)[1])[1])[0]));<br \/>\n  } else {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=trim(\"  \");<br \/>\n  }<br \/>\n  if (!strstr($uniquecountries, \",\" . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . \",\")) {<br \/>\n   $uniquecountries .= urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . \",\";<br \/>\n   \/\/echo $thosetwobits[0] . \"\\n\";<br \/>\n  }<br \/>\n<br \/> <br \/>\n  $countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];<br \/>\n  $countriesisotwo[-1 + sizeof($countriesisotwo)]='';<br \/>\n<br \/>\n \/\/echo \"0:\" . sizeof($countriesarr) . \"\\n\";<br \/>\n }<br \/>\n         } else if (strpos(strtolower($ourfilename), \".csv\") !== false) { \/\/ thanks to https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-admin\/post.php?post=50720&action=edit&message=1<br \/>\n\/\/ \"city\",\"city_ascii\",\"lat\",\"lng\",\"country\",\"iso2\",\"iso3\",\"admin_name\",\"capital\",\"population\",\"id\"<br \/>\n\/\/ \"Tokyo\",\"Tokyo\",\"35.6897\",\"139.6922\",\"Japan\",\"JP\",\"JPN\",\"T\u014dky\u014d\",\"primary\",\"37977000\",\"1392685764\"<br \/>\n\/\/ \"Jakarta\",\"Jakarta\",\"-6.2146\",\"106.8451\",\"Indonesia\",\"ID\",\"IDN\",\"Jakarta\",\"primary\",\"34540000\",\"1360771077\"<br \/>\n<br \/>\n       \/\/echo strtolower($ourfilename) . \"\\n\";<br \/>\n $bits=explode(\"\\n\", $fchunk);<br \/>\n $hbit=str_replace('\"','',strtolower($bits[0]));<br \/>\n $hbits=explode(\",\", $hbit);<br \/>\n $citycol=-1;<br \/>\n $countrycol=-1;<br \/>\n $isocol=-1;<br \/>\n if (strpos((\",\" . $hbit . \",\"), \",city\") !== false && strpos((\",\" . $hbit . \",\"), \",country\") !== false && strpos($hbit, \",\") !== false) {<br \/>\n for ($i=0; $i&lt;sizeof($hbits); $i++) {<br \/>\n   if ($citycol == -1 && strpos($hbits[$i], \"city\") !== false) {<br \/>\n     $citycol=$i;<br \/>\n   } else if ($countrycol == -1 && strpos($hbits[$i], \"country\") !== false) {<br \/>\n     $countrycol=$i;<br \/>\n   } else if ($isocol == -1 && strpos($hbits[$i], \"iso\") !== false) {<br \/>\n     $isocol=$i;<br \/>\n   }<br \/>\n }<br \/>\n if ($citycol &gt;=0 && $countrycol &gt;= 0) {<br \/>\n for ($i=1; $i&lt;sizeof($bits); $i++) {<br \/>\n  if (substr(str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]),0,1) &gt;= \"A\") {<br \/>\n  if (substr($bits[$i],0,1) == '\"') {<br \/>\n  $citiesarr[sizeof($citiesarr)]=str_replace('\"','',explode('\",\"',$bits[$i])[$citycol]);<br \/>\n  } else {<br \/>\n  $citiesarr[sizeof($citiesarr)]=explode(\",\",$bits[$i])[$citycol];<br \/>\n  }<br \/>\n  if (substr($bits[$i],0,1) == '\"') {<br \/>\n  $countriesarr[sizeof($countriesarr)]=str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]);<br \/>\n  } else {<br \/>\n  $countriesarr[sizeof($countriesarr)]=explode(\",\",$bits[$i])[$countrycol];<br \/>\n  }<br \/>\n  if ($isocol &gt;= 0) {<br \/>\n    if (substr($bits[$i],0,1) == '\"') {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=getih(str_replace('\"','',explode(\",\",$bits[$i])[$isocol]));<br \/>\n    } else {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=getih(explode(\",\",$bits[$i])[$isocol]);<br \/>\n    }<br \/>\n  } else {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=trim(\"  \");<br \/>\n  }<br \/>\n  if (!strstr($uniquecountries, \",\" . urlencode(str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . \",\")) {<br \/>\n   $uniquecountries .= urlencode(str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . \",\";<br \/>\n \/\/echo str_replace('\"','',explode(\",\",$bits[$i])[$countrycol]) . \"\\n\";<br \/>\n  }<br \/>\n<br \/> <br \/>\n  $countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];<br \/>\n  $countriesisotwo[-1 + sizeof($countriesisotwo)]='';<br \/>\n  }<br \/>\n }<br \/>\n }<br \/>\n }<br \/>\n<br \/>\n         }<br \/>\n        }<br \/>\n       }<br \/>\n      }<br \/>\n      zip_close($zip);<br \/>\n      $zip=null;<br \/>\n     }<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-zip-tutorial\/'>PHP City Guess Country Game Zip Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcgcgfet'>Previous relevant <a target=_blank title='PHP City Guess Country Game Flag Emoji Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-flag-emoji-tutorial\/'>PHP City Guess Country Game Flag Emoji Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Flag Emoji Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess_readability_flag_emoji.jpg\" title=\"PHP City Guess Country Game Flag Emoji Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Flag Emoji Tutorial<\/p><\/div>\n<p>On top of yesterday&#8217;s <a title='PHP City Guess Country Game Data Extension Tutorial' href='#phpcgcgdet'>PHP City Guess Country Game Data Extension Tutorial<\/a> today&#8217;s progress zeroes in on some aesthetic ideas &#8230;<\/p>\n<ul>\n<li>add country flag emojis <font color=blue>(for interest sake)<\/font> &#8230;<br \/>\n&lt;?php<br \/>\n<code><br \/>\n<font color=blue>function getih($indefe) {<br \/>\n$lri=\"ABCDEFGHIJKLMNOPQRSTUVWXYZ^$\";<br \/>\n$zri=\"abcdefghijklmnopqrstuvwxyz^$0123456789#@!~`\";<br \/>\n$dri=[\"127462\",\"127463\",\"127464\",\"127465\",\"127466\",\"127467\",\"127468\",\"127469\",\"127470\",\"127471\",\"127472\",\"127473\",\"127474\",\"127475\",\"127476\",\"127477\",\"127478\",\"127479\",\"127480\",\"127481\",\"127482\",\"127483\",\"127484\",\"127485\",\"127486\",\"127487\",\"127988\",\"917631\"];<br \/>\n$sri=[\"917601\",\"917602\",\"917603\",\"917604\",\"917605\",\"917606\",\"917607\",\"917608\",\"917609\",\"917610\",\"917611\",\"917612\",\"917613\",\"917614\",\"917615\",\"917616\",\"917617\",\"917618\",\"917619\",\"917620\",\"917621\",\"917622\",\"917623\",\"917624\",\"917625\",\"917626\",\"127988\",\"917631\",\"30\",\"31\",\"32\",\"33\",\"34\",\"35\",\"36\",\"37\",\"38\",\"39\",\"127937\",\"65039\",\"8205\",\"127752\",\"127987\"];<br \/>\n      $thiscc=$indefe;<br \/>\n      $ccsuff='';<br \/>\n      $ccchar=' ';<br \/>\n      $cde='&#';<br \/>\n      for ($iccsuff=0; $iccsuff&lt;strlen($thiscc); $iccsuff++) {<br \/>\n        $ccchar=substr($thiscc, $iccsuff, (1 + $iccsuff));<br \/>\n        if (strtolower($ccchar) == $ccchar) {<br \/>\n        $ccsuff.=$cde . $sri[strpos($lri,$ccchar)] . ';'; \/\/'&#' + dri[eval('' + lri.indexOf(ccchar))] + ';';<br \/>\n        } else {<br \/>\n        $ccsuff.=$cde . $dri[strpos($lri,$ccchar)] . ';'; \/\/'&#' + dri[eval('' + lri.indexOf(ccchar))] + ';';<br \/>\n        }<br \/>\n      }<br \/>\n      return $ccsuff;<br \/>\n}<\/font><br \/>\n<br \/>\nforeach (glob(\"*cities*.xml\") as $filename) {<br \/>\n $fchunk=file_get_contents($filename);<br \/>\n $bits=explode(\"&lt;City&gt;\", $fchunk);<br \/>\n for ($i=1; $i&lt;sizeof($bits); $i++) {<br \/>\n  $thistwobits=explode(\"&lt;\", $bits[$i]);<br \/>\n  $citiesarr[sizeof($citiesarr)]=$thistwobits[0];<br \/>\n  $thistwobits=explode(\"&lt;Country&gt;\", $bits[-1 + $i]);<br \/>\n  $thosetwobits=explode(\"&lt;\", $thistwobits[-1 + sizeof($thistwobits)]);<br \/>\n  $countriesarr[sizeof($countriesarr)]=$thosetwobits[0];<br \/>\n  <font color=blue>if (strpos($ctyisotwo, \"&gt;\" . $thosetwobits[0]) !== false) {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=<font color=blue>getih(<\/font>trim(explode(\"&lt;\",explode('\"&gt;', explode(\"&gt;\" . $thosetwobits[0],$ctyisotwo)[1])[1])[0])<font color=blue>)<\/font>;<br \/>\n  } else {<br \/>\n    $countriesisotwo[sizeof($countriesisotwo)]=trim(\"  \");<br \/>\n  }<\/font><br \/>\n  if (!strstr($uniquecountries, \",\" . urlencode($thosetwobits[0]<font color=blue> . $countriesisotwo[-1 + sizeof($countriesisotwo)]<\/font>) . \",\")) {<br \/>\n   $uniquecountries .= urlencode($thosetwobits[0]<font color=blue> . $countriesisotwo[-1 + sizeof($countriesisotwo)]<\/font>) . \",\";<br \/>\n  }<br \/>\n<br \/>\n  <font color=blue>$countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];<br \/>\n  $countriesisotwo[-1 + sizeof($countriesisotwo)]='';<\/font><br \/>\n<br \/>\n }<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<br \/>\n &#8230; using another <i>&#8220;data extension&#8221;<\/i> via the incredibly <a target=_blank title='Useful link' href='http:\/\/www.nationsonline.org\/oneworld\/country_code_list.htm'>useful link<\/a> where a Country name can be linked to an ISO 2 character country code (integral to forming those country flag emojis in the PHP code above)\n<\/li>\n<li>increase readability by increasing font and element sizes<\/li>\n<\/ul>\n<p>See <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php---GETME\" title=\"city_guess.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php---GETME\" title=\"city_guess.php\">city_guess.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">City Guess Country game<\/a> in action.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-flag-emoji-tutorial\/'>PHP City Guess Country Game Flag Emoji Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcgcgdet'>Previous relevant <a target=_blank title='PHP City Guess Country Game Data Extension Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-data-extension-tutorial\/'>PHP City Guess Country Game Data Extension Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Data Extension Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess_data_extension.jpg\" title=\"PHP City Guess Country Game Data Extension Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Data Extension Tutorial<\/p><\/div>\n<p>We had occasion to revisit the &#8220;City Guess Country Game&#8221; web application of <a title='PHP City Guess Country Game Sharing Tutorial' href='#phpcgcgst'>PHP City Guess Country Game Sharing Tutorial<\/a> and were dismayed at the absence of &#8220;Belgium&#8221; on the country list.   We looked into the workings of the web application and found that it based its City and Country dropdowns based on the contents of <a target=_blank title='http:\/\/www.webserviceX.NET' href='http:\/\/www.webserviceX.NET'>Webservices<\/a> XML files <font size=1>(who we would like to thank profusely)<\/font>.<\/p>\n<p>How to start seeing Belgium, <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=n2lEC58jtMI'>even though we write this on a Wednesday<\/a>?  We think we could either &#8230;<\/p>\n<ul>\n<li>start accessing the <a target=_blank title='http:\/\/www.webserviceX.NET' href='http:\/\/www.webserviceX.NET'>Webservices<\/a> Belgium XML file <font size=1>(but, sadly, if you&#8217;ve tried that last link, you can see why not)<\/font> &#8230; or &#8230;<\/li>\n<li>&#8220;data extend&#8221; <font size=1>(not talk about file extensions)<\/font> the Capitals and Countries data sets of <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/country-via-capital-placeholder-quiz-game-tutorial\/' title='Country via Capital Placeholder Quiz Game Tutorial'>Country via Capital Placeholder Quiz Game Tutorial<\/a> and that way, guarantee at least one city entry per country<\/li>\n<\/ul>\n<p> &#8230; and yes, we opted for the latter.  And yes, we recognize there will be a lopsided number of cities linking to the XML data countries.  True enough, but playing the quiz, this does not detract from the interest of the quiz in our opinion.  And it feels that much more interesting and challenging seeing a full list of country (answer) options for any city (question) ask, in our opinion.<\/p>\n<p>But the proof is in the &#8220;user pudding&#8221; and perhaps you will find <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php--GETME\" title=\"city_guess.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php--GETME\" title=\"city_guess.php\">city_guess.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">City Guess Country game<\/a> more or less challenging than the one lacking Belgium <font size=1>(perhaps because it&#8217;s Wednesday?)<\/font><\/p>\n<p><iframe src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" style=\"width:100%;height:600px;\"><\/iframe><\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-data-extension-tutorial\/'>PHP City Guess Country Game Data Extension Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcgcgst'>Previous relevant <a target=_blank title='PHP City Guess Country Game Sharing Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-sharing-tutorial\/'>PHP City Guess Country Game Sharing Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Sharing Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess_email.jpg\" title=\"PHP City Guess Country Game Sharing Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Sharing Tutorial<\/p><\/div>\n<p>We mentioned how much thought was needed for our revamped Nimh game to involve an Inline HTML Form Email, and thereby be spurning any Javascript &#8220;smarts&#8221; already involved, so as to both &#8230;<\/p>\n<ul>\n<li>collaborate and share and involve more than one game player &#8230; as well as &#8230;<\/li>\n<li>seeing the graphics of that game there in the body section of the email<\/li>\n<\/ul>\n<p> &#8230; and so, rather than jumping straight into Nimh (ouch! &#8230; got burnt!) we are picking &#8230;<\/p>\n<ul>\n<li>a simple PHP game &#8230;<\/li>\n<li>currently involving lots of Javascript &#8220;smarts&#8221; in its workings &#8230;<\/p>\n<li>not yet involving any Inline HTML Form Email functionality<\/li>\n<\/ul>\n<p> &#8230; and work towards collaborating and sharing via those means.  The verdict?  Yes, even for &#8220;small games&#8221; like <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php-GETME\" title=\"city_guess.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php-GETME\" title=\"city_guess.php\">city_guess.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title=\"Click picture\">City Guess Country game<\/a> (you can read the background to, with <a title='PHP City Guess Country Game Primer Tutorial' href='#phpcgcgpt'>PHP City Guess Country Game Primer Tutorial<\/a>), it is no doddle to think &#8220;no Javascript&#8221;.  It is an exercise that helps you appreciate the power and usefulness of client-side Javascript in web applications.  The upside is an improvement of your appreciation of how to pare something down to those smaller &#8220;navigatable&#8221; HTML form snippets to break a concept into collaborative and sharable parts.<\/p>\n<p>Two new HTML form elements become involved, to make this happen &#8230;<\/p>\n<ol>\n<li>the HTML form method=POST <font size=1>action=&#8217;\/\/www.rjmprogramming.com.au\/HTMLCSS\/emailhtml.php&#8217;<\/font> &#8230; to navigate to Inline HTML Form Email creating PHP helper web application &#8230;<br \/>\n<code><br \/>\n&lt;form target=iemail style=display:none; action='\/\/www.rjmprogramming.com.au\/HTMLCSS\/emailhtml.php' method=POST&gt;<br \/>\n &lt;input type=hidden name=inline value=''&gt;&lt;\/input&gt;<br \/>\n &lt;input type=hidden name=emailto id=emailto value=''&gt;&lt;\/input&gt;<br \/>\n &lt;input type=hidden name=subject id=subject value='City Guess Country Game'&gt;&lt;\/input&gt;<br \/>\n &lt;textarea style=display:none; name=htmlis id=htmlis value=''&gt;&lt;\/textarea&gt;<br \/>\n &lt;input type=submit style=display:none; id=contact value=Email&gt;&lt;\/input&gt;<br \/>\n &lt;\/form&gt;<br \/>\n<\/code><br \/>\n &#8230; filling in <i>emailto<\/i> (Email To) and <i>htmlis<\/i> (Inline HTML Form Email content) in a named HTML iframe element, so as not to have to navigate away from the web page &#8230;<br \/>\n<code><br \/>\n&lt;iframe name=iemail src=\/\/www.rjmprogramming.com.au\/HTMLCSS\/emailhtml.php style=display:none;&gt;&lt;\/iframe&gt;<br \/>\n<\/code>\n<\/li>\n<li>the HTML form method=GET <font size=1>action=&#8217;https:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php&#8217;<\/font> shell &#8230;<br \/>\n<code><br \/>\n&lt;form target=_top id=cgcform action='https:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php' method=GET&gt;<br \/>\n&lt;\/form&gt;<br \/>\n<\/code><br \/>\n &#8230; encasing existant HTML City and Country elements\n<\/li>\n<\/ol>\n<p> &#8230; and on returning to &#8220;web browser land&#8221; from &#8220;email client land&#8221; the emailee&#8217;s answers contribute to the PHP logic &#8230;<\/p>\n<p><code><br \/>\n$egoes=\"0\";<br \/>\n$escore=\"0\";<br \/>\n$emdef=\"\";<br \/>\n<br \/>\nif (isset($_GET['thiscity']) && isset($_GET['ucountry']) && isset($_GET['eanswer'])) {<br \/>\n  if ($_GET['ucountry'] == $_GET['eanswer']) {<br \/>\n    $egoes=\"1  Well done!  \" . str_replace(\"+\",\" \",urldecode($_GET['thiscity'])) . \" is indeed in \" . str_replace(\"+\",\" \",urldecode($_GET['eanswer'])) . \".\";<br \/>\n    $escore=\"1\";<br \/>\n  } else {<br \/>\n    $egoes=\"1  Sorry, &lt;a title='Google image search' style=cursor:pointer;text-decoration:underline; onclick=woit(this.innerHTML);&gt;\" . str_replace(\"+\",\" \",urldecode($_GET['thiscity'])) . \"&lt;\/a&gt; is in \" . str_replace(\"+\",\" \",urldecode($_GET['eanswer'])) . \" but is not in \" . str_replace(\"+\",\" \",urldecode($_GET['ucountry'])) . \".\";<br \/>\n  }<br \/>\n  if (isset($_GET['emailfrom'])) {<br \/>\n    $emdef=str_replace(\"+\",\" \",urldecode($_GET['emailfrom']));<br \/>\n  }<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; informing of the user of the &#8220;Check&#8221; (submit button) of their email dropdown selected Country answer for the City presented to them.<\/p>\n<p>We found that second method=GET was the means by which macOS Mail app and Webmail means of emailing were both supported.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-sharing-tutorial\/'>PHP City Guess Country Game Sharing Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcgcgpt'>Previous relevant <a target=_blank title='PHP City Guess Country Game Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-primer-tutorial\/'>PHP City Guess Country Game Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.jpg\" title=\"PHP City Guess Country Game Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Primer Tutorial<\/p><\/div>\n<p>There is no end to the variety of web applications you can do by seeing what free information is out there, but please don&#8217;t disrepect the sources of that information.  The source for our information today is the excellent XML files created at <a target=_blank title='http:\/\/www.webserviceX.NET' href='http:\/\/www.webserviceX.NET'>Webservices<\/a> &#8230; so &#8230; thanks.<\/p>\n<p>Today&#8217;s game is deceptively simple but quite dynamic, in the sense that we set aside a web server directory for our game today that we have called &#8220;City Guess Country Game&#8221; and whatever subset of XML files you have from <a target=_blank title='http:\/\/www.webserviceX.NET' href='http:\/\/www.webserviceX.NET'>http:\/\/www.webservicex.net\/new\/Home\/Index<\/a> are dynamically read to be the source of information.  Here, for the next level up of dynamism you&#8217;d involve an RSS feed perhaps, but, today, we just talk about using what we statically have &#8220;plonked&#8221; in our directory set aside for the game.  The word &#8220;plonked&#8221; always makes me associate with the ever useful PHP method called <a target=_blank title='PHP glob method information' href='http:\/\/php.net\/manual\/en\/function.glob.php'><i>glob<\/i><\/a> &#8230; yes &#8230; glob &#8230; and so it is here, because that &#8220;globbing&#8221; definitely goes on.  What you will perhaps be disappointed with today is that we don&#8217;t use PHP XML native functionality to process the XML data, and please know we recommend trying these approaches as you see fit, but we find the PHP <a target=_blank href='http:\/\/php.net\/manual\/en\/function.explode.php' title='PHP explode method information'><i>explode<\/i><\/a> method relatively easy to deploy for scenarios like this where the data form is so predictable, and simple.<\/p>\n<p>Deceptively simple games can sometimes be the best, and find that that interest, or not, relates to what we are interested in ourselves &#8230; for me that, in particular, is atlases, geography, the &#8220;where&#8221; of life &#8230; so today&#8217;s game interests me as much as it will bore others (no doubt).<\/p>\n<p>We show you PHP source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php_GETME\" title=\"city_guess.php\">city_guess.php<\/a> and a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title='Click picture'>live run<\/a> link as well.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d19522' onclick='var dv=document.getElementById(\"d19522\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/games\/\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d19522' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d48050' onclick='var dv=document.getElementById(\"d48050\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/email\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d48050' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d50695' onclick='var dv=document.getElementById(\"d50695\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/data\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d50695' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d50702' onclick='var dv=document.getElementById(\"d50702\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/flag\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d50702' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d50720' onclick='var dv=document.getElementById(\"d50720\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/zip\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d50720' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d50731' onclick='var dv=document.getElementById(\"d50731\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/keyboard\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d50731' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d50740' onclick='var dv=document.getElementById(\"d50740\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/data\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d50740' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d50755' onclick='var dv=document.getElementById(\"d50755\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/geodata\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d50755' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Think &#8220;where&#8221;, think &#8220;geodata&#8221;. And with this in mind, today&#8217;s improvements on yesterday&#8217;s PHP City Guess Country Game Massaging Tutorial is to, where it is available in the chain of data sources the City Guess Quiz web application accepts, if &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-geodata-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[2419,2698,1824,3232,2081,2247,283,290,299,2310,367,380,382,385,2242,452,476,477,1619,3208,480,481,518,576,604,2487,2395,3266,652,673,3465,812,1705,2337,932,997,1022,3420,1063,2311,1294,1319,1497],"class_list":["post-50755","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-aesthetics","tag-carriage-return","tag-character","tag-city","tag-country","tag-country-code","tag-csv","tag-data","tag-database-2","tag-details","tag-dropdown","tag-email","tag-email-form","tag-emoji","tag-flag","tag-form","tag-game","tag-games-2","tag-geo-chart","tag-geochart","tag-geodata","tag-geographicals","tag-google-chart","tag-html","tag-index","tag-inline","tag-iso","tag-iso-code","tag-javascript","tag-keyboard","tag-massaging","tag-mouse","tag-onkeydown","tag-onkeypress","tag-php","tag-programming","tag-quiz","tag-return","tag-reveal","tag-summary","tag-touch","tag-tutorial","tag-zip"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/50755"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=50755"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/50755\/revisions"}],"predecessor-version":[{"id":50763,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/50755\/revisions\/50763"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=50755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=50755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=50755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}