can i put the same data in the two different drop box?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Krista

    can i put the same data in the two different drop box?

    Hi, can i load the same table in the two drop-down list?
    $DBName = Krista;
    $Query = "select * from Parts";
    $ResultPart0 = mysql_db_query( $DBName, $QueryPart, $linkID);
    $ResultPart1 = mysql_db_query( $DBName, $QueryPart, $linkID);
    .........
    <tr><td>Part Number 0 from Inventory:</td>
    <td><select name =\"Assembled_Pa rt\">");
    $count = 0;
    while($Row0 = mysql_fetch_arr ay($ResultPart0 )){
    $count++;
    print("<option value =\"$count\">$Ro w0[Part_Number]</option>");
    }
    print(" </select></td></tr>

    <tr><td>Part Number 1 from Inventory:</td>

    <td><select name =\"Assembled_Pa rt1\">");
    $count1 = 0;
    while($Row1 = mysql_fetch_arr ay($ResultPart1 )){
    $count1++;
    print("<option value =\"$count1\">$R ow1[Part_Number]</option>");
    }
    print(" </select></td></tr>
    ............... .....
    ............... ....

    when i do like this, i can load from the table , but i cannot get the
    result after i click the submit button. eg.
    print $_GET['Assembled_Part 0'];
    print $_GET['Assembled_Part 1'];
    it can only show the first one result, do u guys have any idea for me
    to solve it? I want to get both of them. Thanks
    krista
  • Pedro Graca

    #2
    Re: can i put the same data in the two different drop box?

    Krista wrote:[color=blue]
    > Hi, can i load the same table in the two drop-down list?
    > $DBName = Krista;
    > $Query = "select * from Parts";
    > $ResultPart0 = mysql_db_query( $DBName, $QueryPart, $linkID);[/color]
    What is $QueryPart? _______________ ______^^^^^^^^^ ^__

    Other than that, I think it should work; but haven't tested your code.

    To avoid such problems (if this is it) in the future put
    <?php
    error_reporting (E_ALL)
    ini_set('displa y_errors', '1');
    ?>

    at the very beginning of your scripts so that PHP complains about much
    more than usual :)
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • Nikolai Chuvakhin

      #3
      Re: can i put the same data in the two different drop box?

      ywan_ip@hotmail .com (Krista) wrote in message
      news:<eb97c972. 0312311133.6587 b063@posting.go ogle.com>...[color=blue]
      >
      > Hi, can i load the same table in the two drop-down list?[/color]

      Yes, and there doesn't have to be two queries, either:

      $Query = "select * from Parts";
      $result = mysql_query ($Query);
      echo '<select name="dropdown1 ">';
      while ($record = mysql_fetch_arr ay ($result)) {
      // the first drop-down list is output here...
      }
      echo '</select>';
      mysql_data_seek ($result, 0); // rewind the data pointer
      echo '<select name="dropdown2 ">';
      while ($record = mysql_fetch_arr ay ($result)) {
      // the second drop-down list is output here...
      }
      echo '</select>';

      Cheers,
      NC

      Comment

      Working...