Question: I have this html part for a dropdown menu:

```
<form name="navList" onsubmit="return submitForm();">
<select name="subMenu">
<option value> </option>
<option value> CR_ID </option>
<option value> CR_HEADLINE </option>
<option value> CRI_CLOSEDATE </option>
<option value> CRI_ASSIGNEE </option>
</select>

```

How can I change this into php, using this function?

```
foreach($array as $key=>$value)
{
$html .= "<option value='$key'>$value</key>";
}
echo "<select name="process">$html</select>";

```

Answer: 
You forget to add escape sequences in your output . Please refer this [demonstration](http://www.tuxradar.com/practicalphp/2/6/2):- 

```
$optionArray = array(
            0 => 'CR_ID',1=> 'CR_HEADLINE',
            2 => 'CRI_CLOSEDATE',3 => 'CRI_ASSIGNEE'
            );
foreach($optionArray as $key=>$value)
{
$html .= "<option value='$key'>$value</key>";
}
echo "<select name=\"process\">".$html."</select>";

```

OR 

```
    echo '<select name="process">'.$html.'</select>';

```
```
<?php

$html ='';
$myArray = array(0 => '',1 => 'CR_ID',2=> 'CR_HEADLINE', 3 => 'CRI_CLOSEDATE',4 => 'CRI_ASSIGNEE');

foreach($myArray as $key=>$value)
{
    $html .= "<option value='$key'>$value</key>";
}

echo "<select name=\"process\">".$html."</select>";

```

Link - <http://codepad.viper-7.com/YpccFw>