1.我选择是的第二种做法:$queryc="select count(*) from table1";
$resultc=$db->ExeCute($queryc);
if($resultc->fields['0']>0)
 {
 $result=$db->GetAll($query);
}
2.用下面的这条语句:
echo "<script>document.form1.selectbox.value='".$rs['selectvar']."';</script>";
$rs['selectvar']从数据库中读取出来的数据存入$rs,然后调用下拉框所代表的数据库表中字段
不知道说清楚了没有

解决方案 »

  1.   

    <form name=form1 ENCTYPE="multipart/form-data" method="post" action=<?PHP_SELF?>"add_finish.html" onSubmit="return Check()" >
    <select name="shouru">
    <option value="a">1000</option>
    <option value="b">2000</option>
    <option value="c">3000</option>
    <option value="d">4000</option>

    </select>
    <?
    echo "<script>document.form1.shouru.value='".$rs[shouru']."';</script>";
    ?>
    </form1 >2.
    <form name=form1 ENCTYPE="multipart/form-data" method="post" action=<?PHP_SELF?>"add_finish.html" onSubmit="return Check()" >
    <select name="shouru">
    <option value="a">1000</option>
    <option value="b">2000</option>
    <option value="c">3000</option>
    <option value="d">4000</option>

    </select>
    <script>document.form1.shouru.value='+<?=$rs['shouru']?>+';</script>;
    </form1 >
      

  2.   

    1、GETALL 方法期望返回一个数组,不成功时返回假
    实用时宜
    $queryc="select count(*) from table1";
    if($result=$db->GetAll($query)){
      //成功时的操作
    }2、见手册中的例子,当然选中项你要适当保存
    index.php:require('Smarty.class.php');
    $smarty = new Smarty;
    $smarty->assign('cust_ids', array(1000,1001,1002,1003));
    $smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
    Johnson','Carlie Brown'));
    $smarty->assign('customer_id', 1001); //设置默认选项
    $smarty->display('index.tpl');index.tpl:<select name=customer_id>
        {html_options values=$cust_ids selected=$customer_id output=$cust_names}
    </select>
    index.php:require('Smarty.class.php');
    $smarty = new Smarty;
    $smarty->assign('cust_options', array(
                1001 => 'Joe Schmoe',
                1002 => 'Jack Smith',
                1003 => 'Jane Johnson',
                1004 => 'Charlie Brown'));
    $smarty->assign('customer_id', 1001);
    $smarty->display('index.tpl');index.tpl:<select name=customer_id>
        {html_options options=$cust_options selected=$customer_id}
    </select>
    OUTPUT: (both examples)<select name=customer_id>
        <option value="1000">Joe Schmoe</option>
        <option value="1001" selected="selected">Jack Smith</option>
        <option value="1002">Jane Johnson</option>
        <option value="1003">Charlie Brown</option>
    </select>
      

  3.   

    MSN ?
    他不认我的口令,我把他开除了。