SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict suzkaw's Avatar
    Join Date
    Apr 2002
    Location
    North Carolina
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Foreach array question

    I am using the following code to get all items posted to a page. It works fine except now I need to display the optName out of the foreach loop. So my question is how do I assign the optName to something I can loop through again?

    PHP Code:
    foreach(@$_POST as $objItem => $objValue){
                    if(
    substr($objItem,0,4)=="MQTY"){
                        
    $quantity $objValue;
                        if(
    $quantity ) {
    //database stuff has been taken out
                  
    $optName=$rs["optName"];
         }

    Thanks Eric.

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2004
    Location
    Madison, WI
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe try...
    PHP Code:
    $optName[]=$rs["optName"]; 
    that'll make an array that you can loop through

  3. #3
    SitePoint Addict suzkaw's Avatar
    Join Date
    Apr 2002
    Location
    North Carolina
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you that worked perfectly!
    Thanks Eric.


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
  •