+5  A: 

Embed 'error' within the 'li' tags, so it won't produce extra output. Something like:

echo "<li> error, $value </li>";
jujav4ik
A: 

this is now fixed no need to answer sorry guys

joe
Will you provide the answer so we all know what was happening? Or remove the question.
cdburgess
+1  A: 

Watch your tag

<li/>

Maybe this will help:

</li>

:)

killer_PL
+1  A: 

I have checked. This is work.

$a[0] = 'Please enter address line 1';
$a[1] = 'Please tell us your first name';
foreach ($a as $b) {
    echo $b;
}
Alexander.Plutov