SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Populting dropdown menu from data base & select value to view details from DB in php

    Dear All
    I am using below script to populate the drop down menu & its working fine.

    *****************

    <html>
    <head><title>hjhj</title></head>
    <body>

    Select Car:
    <form method="post" action="vod0011.php">
    <label for="select"><select name="buyr" value="buyr" size="1">

    <?php
    require("connect.php");
    $sql = "SELECT distinct buyr FROM tbl_buyr ";
    $result = mysql_query($sql) or die (mysql_error());
    while ($row = mysql_fetch_array($result))
    {
    $tbl_buyr_id = $row["tbl_buyr_id"];
    $buyr = $row["buyr"];
    $options.="<OPTION VALUE=\"$tbl_buyr_id\">".$buyr;
    }
    ?>

    <option value="$options"> <?php echo $options ?> </option>
    </select>
    <input type="submit" name="Submit" value="Submit">
    </form>

    </body>
    </html>

    ***************************

    But when i select the data & submit the form it doesn't retrieve any details from database.

    Here is my vod0011.php

    **************************

    <?php
    error_reporting(0);
    require("connect.php");
    $buyr = $_POST['buyr'];

    $query="SELECT * FROM tbl_order, tbl_buyr, tbl_fact1
    WHERE
    buyr ='$buyr'
    AND tbl_order_id=buyr_tbl_order_id
    AND tbl_order_id=fact1_tbl_order_id
    AND ship_status > 0 ORDER BY shipmentdate, buyh, buyr ASC";
    $result=mysql_query($query);

    $num=mysql_numrows($result);

    mysql_close();
    ?>
    *************************

    Kindly advise why???

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Every one!!!! I got the solution. Thnx


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
  •