Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts

    foreach not working

    Hello, I have the following code that isn't working, can somebody please let me know what I am doing wrong.
    Code:
    $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.

  • #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    PHP Code:
    $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;}
        }


  • #3
    Regular Coder
    Join Date
    Apr 2005
    Posts
    388
    Thanks
    0
    Thanked 0 Times in 0 Posts
    one too many ;'s thanks for your help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •