在fom加载时,数据库中不显示drropdownlist值

时间:2011-05-25 14:01:59

标签: php mysql

<?php

require_once("../../db_connect/db_connect.php");


$decoded = json_decode($_GET['json']);
$ias = $decoded->{'ias'};
$ian = $decoded->{'ian'};

$select = "select iacode,ianame from isdsmot_ia_creation";
$res = mysql_query($select);
while ($row = mysql_fetch_array($res)) {
    $ias = $row['iacode'];
    $ian = $row['ianame'];
    $ia=$ias."|".$ian;

echo "<OPTION value = \"" . $row[0] . "|" . $row[1] . "\">" . $ia . "</OPTION>";
}

$result=$ia;
    if ($result) {

        echo "Successful" . mysql_error();
    } else {

        echo "Unsuccess" . mysql_error();
    }

?>

1 个答案:

答案 0 :(得分:0)

这会对您有所帮助:添加

<?php

require_once("../../db_connect/db_connect.php");


$decoded = json_decode($_GET['json']);
$ias = $decoded->{'ias'};
$ian = $decoded->{'ian'};

$select = "select iacode,ianame from isdsmot_ia_creation";
$res = mysql_query($select);
echo '<select name="myDropDown">';
while ($row = mysql_fetch_array($res)) {
    $ias = $row['iacode'];
    $ian = $row['ianame'];
    $ia=$ias."|".$ian;

    echo "<OPTION value = \"" . $row[0] . "|" . $row[1] . "\">" . $ia . "</OPTION>";
}
echo '</select>';

$result=$ia;
    if ($result) {

        echo "Successful" . mysql_error();
    } else {

        echo "Unsuccess" . mysql_error();
    }

&GT;