SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Array into comma seperated line?!?

    I'm trying to make a multiple select field and want the userid's to come in a comma seperated line.

    As it is now I get the data like this:
    PHP Code:
    $reciever $_POST['recievers'];
    print_r ($reciever); 
    This gives an output like this:
    Array ( [0] => 235 [1] => 60 )

    What I want is to have an output like this:
    235,60

    Please help...

  2. #2
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by addcomex View Post
    Convert Comma Separated String into Array


    <?php
    $str="foo,bar,baz,bat";
    $arr=explode(",",$str);
    // print_r($arr);
    ?>

    And more
    But the problem is... How do I get the:
    PHP Code:
    $reciever $_POST['recievers']; 
    into:
    $str="foo,bar,baz,bat";

    ???

  3. #3
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    See implode().
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  4. #4
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    See implode().
    Yes sir... Thanks man... Merry Christmas :-)

  5. #5
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You too buddy, you too.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.


Bookmarks

Posting Permissions

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