i have the following code:

<td width='100px'>Suppliers
                <select name="supplier">
                    <?php
                       $catcher_id = $service->getCatcherId();
                       $supplier_names = LpmAdnetworkPeer::getByName($catcher_id);
                       foreach($supplier_names as $row) 
                       { 
                           ?>
                           <option><?php echo $row->getName();
                           ?></option>
                    <?php      
} ?> </select> </td>

then on the same form i have a submit button that takes me to the next form..the problem now is how can i access the ID of the item seleted in the dropdown on the NEXT form please?
i can get the name from the list by $_POST['supplier'] on the next form
thanks

    What do you mean "the ID of the item selected" ? Are you saying LpmAdnetworkPeer::getByName() returns results that include some "ID" value (e.g. one you haven't shown us anything about)?

    If so, then perhaps you should be setting the options' values to that ID value instead of using the name?

      You will not get any form field ids in php using $POST, $GET and $_REQUEST, Here only you will get selected value from the select box.

        i have the code now as:
        <table width='600px' class='tbl_content_box' border='0' cellspacing='0'>
        <tr>
        <td width='100px'>Products:</td>
        <td width='100px'>Graphic</td>
        <td width='100px'>Text</td>
        <td width='100px'>Suppliers

                    <select name="supplier">
                        <?php
                           $catcher_id = $service->getCatcherId();
                           $supplier_names = LpmAdnetworkPeer::getByName($catcher_id);
                           foreach($supplier_names as $row) 
                           { 
                             ?>
        
                              <option value="<?php echo $Name . "/" . $id; ?>"><?php echo $row->getName();?></option> 
        
                        <?php      
                           } ?>
                    </select>
                    </td>   
                </tr>    
             </table>

        and when i hit the sumbit button on this form i go to documentSuccess.php where i can get the id and name by:
        <?php
        $input= $_POST['supplier'];
        list($name, $id, $client_code) = explode("/", $input);
        ?>

        only thing now is i also have a client code and as soon as i add it to the option tag and also add it to the list statement above i get an offset error...

        how can i add the 3rd value???
        thanks

          4 days later
          helloise;10971834 wrote:

          i have the code now as:
          <table width='600px' class='tbl_content_box' border='0' cellspacing='0'>
          <tr>
          <td width='100px'>Products:</td>
          <td width='100px'>Graphic</td>
          <td width='100px'>Text</td>
          <td width='100px'>Suppliers

                      <select name="supplier">
                          <?php
                             $catcher_id = $service->getCatcherId();
                             $supplier_names = LpmAdnetworkPeer::getByName($catcher_id);
                             foreach($supplier_names as $row) 
                             { 
                               ?>
          
                                <option value="<?php echo $Name . "/" . $id; ?>"><?php echo $row->getName();?></option> 
          
                          <?php      
                             } ?>
                      </select>
                      </td>   
                  </tr>    
               </table>

          and when i hit the sumbit button on this form i go to documentSuccess.php where i can get the id and name by:
          <?php
          $input= $_POST['supplier'];
          list($name, $id, $client_code) = explode("/", $input);
          ?>

          only thing now is i also have a client code and as soon as i add it to the option tag and also add it to the list statement above i get an offset error...

          how can i add the 3rd value???
          thanks

          You should add client code to option label like below

          <option value="<?php echo $Name . "/" . $id."/".$clientcode; ?>"><?php echo $row->getName();?></option>

          I have given $clientcode variable just for your reference you replace correct value.

            Write a Reply...