Adding a List Box in a custom PHP Form with Products

Discussion in 'Customization & add-ons' started by jboyce, Nov 21, 2007.

  1. jboyce

    jboyce New Member

    Joined:
    Jun 23, 2007
    Messages:
    1
    I'm hoping someone has done this before, I'm trying to populate a listbox in a Form with the array returned from $_SESSION['_amember_products']. I'm doing something similar from a DB Table but don't have the expertise working with arrarys.

    Following is what I'm doing with a DB and want to do the same from the SESSION Products. Any help you can offer would be greatly appreciated !!

    PHP:
    <?php    
    echo "<form method='get' action='test.php' ID='form'>";
    // I would like to replace the following with the $_SESSION['_amember_products' array of all products...
    $query "SELECT recordid AS id, DATE_FORMAT(filedatetime, '%T') AS 'timefmt' FROM `ccimages`";
    $result mysql_query ($query);
    echo 
    "Select Time  ";
    echo 
    "<select name=id value=''>Time</option>"// printing the list box select command
    while($nt=mysql_fetch_array($result)){ //Array or records stored in $nt
    echo "<option value=$nt[id]>$nt[timefmt]</option>";
    /* Option values are added by looping through the array */
    }
    echo 
    "</select>";// Closing of list box 
    echo "&nbsp;";
    echo 
    "<input type='hidden' name='dd' value='".$dd."' ID='dd'>"
    echo 
    "</form>";
    ?>
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    You can use
    foreach($_SESSION[_amember_products] as $p)
    $p will contain product info.

Share This Page