You can pretty freely mix php and html code together. You need to make sure that any php code is within <?php and ?> tags. The thing to remember is to make sure the file always has a .php extension, or your php code will not execute.
Here is an example based on what you appear to be trying to do:[php]
City Selector
<?php
$cities = array('New York','Hong Kong','Munich','Moscow','London','Paris');
?>
<?php
foreach($cities as $city)
{
echo "$city";
}
?>
[/php]
You will notice that I am using “echo” instead of “print.” There are a couple of differences between the two, but you can use either one in nearly every situation you are likely to run into. Most php programmers use echo. Tests have shown echo to be slightly faster (so slight that I have never seen a situation where it was relevant). Also, print returns a value, where echo doesn’t. The code above will work equally well with either echo or print.
There are many different ways to do the same thing with php. I tried to mix a few different approaches in the example so that you can see a couple of options. In the end, it comes down as much to personal taste as anything.