Am trying the W3S's AJAX tute, which uses an ASP script, and says "It could easily be rewritten in PHP, or some other server language." I'd like to finish this, but my PHP script's still not working, although it's probably 90% functional. Can anyone help get it up and running?Here's the source page:http://www.w3schools.com/ajax/ajax_source.aspThe script is called "gethint.asp." and is in the 3rd CODE section, under the Head "The AJAX Server Page."Here's my PHP version so far:
<?php$a = array();$a[1] = "Anna";$a[2] = "Brittany";$a[3] = "Cinderella";$a[4] = "Diana";$a[5] = "Eva";$a[6] = "Fiona";$a[7] = "Gunda";$a[8] = "Hege";$a[9] = "Inga";$a[10] = "Johanna";$a[11] = "Kitty";$a[12] = "Linda";$a[13] = "Nina";$a[14] = "Ophelia";$a[15] = "Petunia";$a[16] = "Amanda";$a[17] = "Raquel";$a[18] = "Cindy";$a[19] = "Doris";$a[20] = "Eve";$a[21] = "Evita";$a[22] = "Sunniva";$a[23] = "Tove";$a[24] = "Unni";$a[25] = "Violet";$a[26] = "Liza";$a[27] = "Elizabeth";$a[28] = "Ellen";$a[29] = "Wenche";$a[30] = "Vicky";$q = strtoupper($_GET("q"));if ( strlen($q) > 0) { $hint = ""; for ($i = 1; $i <= 30; $i++) { if ($q = strtoupper( substr( a[$i], 1, strlen($q))) { if ($hint = "" ) { $hint = $a[i]; } else { $hint = $hint . " , " . $a[i]; } } }}}if ($hint = "") { echo "no suggestion";}else { echo $hint;}?>
Some probable problems are 1. I'm unsure if ECHO's the right way to output the response.2. Number of braces -- didn't check these yet, may be off.Any help would be appreciated, thx.