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,然后调用下拉框所代表的数据库表中字段
不知道说清楚了没有
$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,然后调用下拉框所代表的数据库表中字段
不知道说清楚了没有
解决方案 »
- mysql_real_escape_string 能防止SQL注入吗
- 一个面试题、求牛人指点……
- 标题党
- PHP 聊天功能原理 (是类似网页上的客服系统__非聊天室)
- 如何利用PHP GD库将像素点变大
- UPDATE ... SET `count`=`count`+1 为什么会一次增加2
- 提交数据后,有个history.go(-1)的动作,总是出现什么过期,刷新一下才能显示,我的代码也没错误啊
- 如何让一个表单只输入英文??
- 关于ftp_rawlist?
- 如何把Win2000写的PHP程序COPY到Linux主机上,详细点!!!!
- 用户登陆验证问题,总是搞不定,请各位帮忙
- 请教:关于购物车的安全认证问题
<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 >
实用时宜
$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>
他不认我的口令,我把他开除了。