...

View Full Version : foreach not working



davehaz
06-24-2005, 10:31 PM
Hello, I have the following code that isn't working, can somebody please let me know what I am doing wrong.


$mls = $_POST['mls'];
$multimls = explode(';',$mls);
$count = count($multimls);
$_SESSION['multimls'] = $multimls;
$_SESSION['mls'] = $mls;
if (isset($submit)) {
if ($count > 1 ){
foreach($multimls as $key => $mls2);{
echo $mls2;}
}}


it basically takes input from a form, explodes it into an array and is supposed to just echo the elements out(in this script, in the rest it actually peforms other actions) it is only echoing the last variable.
Thanks.

devinemke
06-24-2005, 10:59 PM
$mls = $_POST['mls'];
$multimls = explode(';', $mls);
$count = count($multimls);
$_SESSION['multimls'] = $multimls;
$_SESSION['mls'] = $mls;
if (isset($submit))
{
if ($count > 1)
{
foreach ($multimls as $key => $mls2) {echo $mls2;}
}
}

davehaz
06-24-2005, 11:09 PM
one too many ;'s thanks for your help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum