从Array Elements获取POST值

I'm having trouble getting POST value from dynamically generated txtinput[] and MultiSelect since they form an array. I read so many articles but I get confuse..

a short form of my code is given below..

Pls help me with best way how I can get array values in the form of a string "value1, value2, value3"

Regards... and Thanks..... below is my code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta charset="UTF-8">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>

<script type="text/javascript">

$(function(){
       //initially hide the textbox
            $("#other_lang").hide();
            $('#lang').change(function() {
              if($(this).find('option:selected').val() == "Other - specify"){
                $("#other_lang").show();
              }else{
                $("#other_lang").hide();
              }
            });
            $("#other_lang").keyup(function(ev){
                var othersOption = $('#lang').find('option:selected');
                if(othersOption.val() == "Other - specify")
                {
                    ev.preventDefault();
                    //change the selected drop down text
                    $(othersOption).html($("#other_lang").val()); 
                } 
            });
            $('#form_id').submit(function() {
                var othersOption = $('#lang').find('option:selected');
                if(othersOption.val() == "Other - specify")
                {
                    // replace select value with text field value
                    othersOption.val($("#other_lang").val());
                }
            });
        });

    var counter = 1;
    var limit = 3;
    var phonefields = "<input name='phoneno[]' id='phoneno[]' class='phoneno' type='text'/>";
function addInput(divName){


     if (counter == limit)  {
          alert("Max. " + counter + " Phone numbers only");
     }
     else {
          var newdiv = document.createElement('div');
          newdiv.innerHTML = phonefields;
          document.getElementById(divName).appendChild(newdiv);
          counter++;
     }
}

</script>

</head>

<body>
<form  class="form" method="post" name="form" action="">
        <label for="langs">Languages:</label><?php dyn_languages() ;?>
        <input id="other_lang" name="other_lang" type="text" placeholder="Other lang" /><br /><br /><br />

        <label for="phoneno[]">Phone No:</label>
        <input id="buttonAsLink" type="button" onClick="addInput('dynamicInput')">         
        <div id="dynamicInput"><input name='phoneno[]' id='phoneno[]' type='text'/></div>

        <input name="submit" type="submit" value="Submit" />
</form>

<?php 
//----Dynamic SelectBox for languages
function dyn_languages(){
        $langs = array (1 => 'English', 'French', 'German', 'Russian', 'Spanish', 'Other - specify');

        echo "<select size='6' name='lang' id='lang' multiple='multiple'>";
        foreach ($langs as $value) {
            echo (in_array($value,$_POST)) ? '<option value="'.$value.'" selected>'.$value.'</option>
' : '<option value="'.$value.'">'.$value.'</option>
';
        } echo '</select>';

}//--END Function* --Dynamic SelectBox for languages

//--- POST Action
if(isset($_POST['submit'])){
        $phoneno = $_POST['phoneno'];
        $langs = $_POST['lang'].",".$_POST['other_lang'];

        $sql = "INSERT INTO table(lang, phoneno) VALUES ('$phoneno','$langs')";
        echo "<hr />".$sql; 
}
//--- END POST Action
?>

</body>
</html>

If I understand correctly, you should try this

$phoneno = implode(', ',$_POST['phoneno']);

http://php.net/manual/en/function.implode.php

I managed to do it with

foreach ($_POST['phoneno'] as $ph) {$phoneno.= $ph.", ";}
foreach ($_POST['lang'] as $lng) {$langs.= $lng.", ";}