单选按钮不显示数据库中的值 [英] Radio buttons not showing values from database

查看:90
本文介绍了单选按钮不显示数据库中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我是一个菜鸟,想用我的数据库显示记录,一个字段使用单选按钮。问题是我无法从表中获取值来检查相应的单选按钮。


任何帮助很多人赞赏


干杯:)

[php]

$ sponsored =(''IsSponsored''== 1)?" checked" :" ;;

$ notsponsored =(''IsSponsored''== 0)?"" :" checked";


while($ show = mysql_fetch_array($ result)){

//将每行的内容打印到表格中

echo"< tr> < TD>英寸;

echo $ show [''ChildID''];

echo"< / td> < td>" ;;

echo $ show [''givenName''];

echo"< / td> < td>" ;;

echo $ show [''gender''];

echo"< / td> < td>" ;;

echo $ show [''countryName''];

echo"< / td> < td>" ;;

echo $ show [''favouritePlay''];

echo"< / td> < td>" ;;


/ *此框检查IsSponsored = 1 * /

echo"< input type = \" radio\"命名= \"" $显示[ childID的]" IsSponsored''\"值= \" 1\" "。$ spons。">" ;;


echo"< / td> < TD>英寸;


/ *此框检查IsSponsored = 0 * /

echo"< input type = \" radio\"命名= \"" $显示[ childID的]" IsSponsored''\"值= \" 0\" "。$ notsponsored。">" ;;


echo"< / td> < td>" ;;

echo $ show [''dateOfBirth''];

echo"< / td> < / TR>英寸;

} [/ php]

在代码周围使用适当的代码标签 - 主持人

推荐答案

spons =(''IsSponsored''== 1)?" checked" :" ;;
sponsored = (''IsSponsored'' == 1)?"checked" : "";


notsponsored =(''IsSponsored''== 0)?"" :" checked";


while(
notsponsored = (''IsSponsored'' == 0)?"" : "checked";

while(


show = mysql_fetch_array(
show = mysql_fetch_array(


这篇关于单选按钮不显示数据库中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆