Hi, I didn't quite know where this should go inside the PHP user manual. It is a collection of six simple tricks I use to give websites that extra flair of functionality. http://joot.com/dave/writings/articles/php-examples.shtml I hope you find the auto-complete city and country is especially useful. Sincerely, Dave Jarvis
Dave: Thanks for posting your code -- it works great! However, I detected a slight problem, which can be corrected like so. //------------------------------------------- function get_tag_contents( $xml, $tag ) { $result = ""; $s_tag = "<$tag>"; $s_offs = strpos( $xml, $s_tag ); // Note, use === because == will not work as expected. // The position of the first character is zero not one. if ($s_offs === false) { echo ("(1) The needle was not found in the haystack \" $xml\"."); } else { $e_tag = "</$tag>"; $e_offs = strpos( $xml, $e_tag, $s_offs ); // If we have both tags, then dig out the contents. // if( $e_offs === false ) { echo ("(2) The needle was not found in the haystack \" $xml\"."); } else { $result = substr( $xml, $s_offs + strlen( $s_tag ), $e_offs - $s_offs - strlen( $e_tag ) + 1 ); } } return $result; } //------------------------------------------- tedd -- -------------------------------------------------------------------------------- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php