I am trying to create a form using php. I am unsure how to put the country drop down menu right after the city field. I am not sure the best way to do this I have my array.
$labels = array (
"first_name" => "First Name",
"last_name" => "Last Name",
"address" => "Address",
"city" => "City",
"email" => "E-mail",
"phone" => "Phone", );
$country = array (
"select" => "",
"us" => "United States",
"ca" => "Canada",
"mx" => "Mexico", );
$submit = "Submit";
?>
Here is the display code:
<?php
echo "<h2>Customer Info</h2>";
echo "<form action='checkBlank.php' method='post'>";
foreach ( $labels as $field => $label)
{
echo "<div class='field'>
<label for='$field'>$label</label>
<input id='$field' name='$field' type='text'
size='42' /></div>";
if($field == "city") {
echo "<label for='country'>Country</label>
<select id='country' name='country'>";
foreach ( $country as $select => $option)
{
echo "<option value='$value'>$option</option>";
}
echo "</select>";
}
}
echo "<div id='submit'>
<input type='submit' value='$submit'></div>
</form>";
?>
<select>and<option>, why the input?