SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating a URL's from comma delimited field

    How can I convert a field that contains text like this

    phones,computers,laptops


    into turning each word between the comma's into url's for example
    making phones http://yoururl.com/phones or http://yoururl.com/computers

    etc..

    thanks

  2. #2
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $categories 'phones,computers,laptops';
    $categories explode(','$categories);

    foreach(
    $categories as $cat) {
        
    $cat trim($cat);
        echo 
    "http://yoururl.com/$cat";


  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that worked thanks man


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
  •