Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Exploding a list of urls…Going insane.

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35504
    kgscott284
    Participant

    Well, I am a front end guy, but I have an interest in everything so i am trying to figure out how to use PHP for some mundane tasks…basically what i want to do is split a list (delimited by a comma) and insert the values of the list into params/attribute in so i only have to copy paste a list once instead of the thousands of urls over and over…Here is where i got stuck:







    if (isset($_POST)) {
    $urls = trim($_POST);
    $arr = explode( ",", $urls);
    $count= count($arr);

    // need to loop through the array here...don't know how...i was thinking a for or while loop..??
    echo '' . thearrayitem[0] . '';
    }
    ?>

    // It should output something like:

    http://www.link1.com
    http://www.link2.com
    http://www.link3.com

    Except “thearrayitem[0]” should be the index as a variable so it can iterate through the items…
    Any help would be much appreciated thanks gin advance!

    #92016
    Johnnyb
    Member

    I’m not really a PHP guy either, but to loop through the array wouldn’t it be something like this:


    for ($i = 0; $i <= count(thearrayitem); $i++) {
    echo ' . '>' . thearrayitem . '';
    }
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.