passing arrays from checked items...having problems

Discussion in 'PHP' started by dwest, Jan 22, 2007.

  1. #1
    This code...
    
    <?php
    
    foreach ($_POST['id'] as $id)
        {
            echo $id.'<br />';
                foreach ($_POST['hid_name'] as $hid_name)
                    {
                       echo $hid_name.'<br />';
                    }
        }
    
    ?>
    
    Code (markup):
    Is giving me this...

    3
    Professional Website Development
    Annual Website Hosting
    4
    Professional Website Development
    Annual Website Hosting

    Instead of this, which is what I want...

    3
    Professional Website Development
    4
    Annual Website Hosting

    What am I doing wrong??
     
    dwest, Jan 22, 2007 IP
  2. zurc

    zurc Banned

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    elaborate the code if you want us to solve your riddle :)
     
    zurc, Jan 23, 2007 IP
  3. dwest

    dwest Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think I'm just going to try a different approach altogether now that I've slept on it.

    Thanks!
     
    dwest, Jan 23, 2007 IP