自学的小疑点,帮忙看看

WBOY
Release: 2016-06-13 12:16:54
Original
815 people have browsed it

自学的小问题,帮忙看看
为什么有数据 checkbox 无法选中呢?哪里的问题 高手帮忙看看







mysql_connect('localhost','root','root');
mysql_select_db('ceshi');
mysql_query('set names utf8');

$sql="select * from test where username='小丁'";
$result=mysql_query($sql);
$row=mysql_fetch_assoc($result);


$a=$row['love'];
$arr=explode('|', $a);

$ah=array('打麻将','看电影','英雄联盟','睡觉');

?>

用户名:


爱好: for ($i=0;$i $sled='';
if(in_array($ah[i],$arr)){
$sled='checked';
}

?>

>

endfor;
?>
Copy after login

------解决思路----------------------
if(in_array($ah[i],$arr)){

if(in_array($ah[ $i],$arr)){
------解决思路----------------------
原来是这个问题!
if(in_array($ah[ i],$arr)){
少了 $
应为
if(in_array($ah[ $i],$arr)){

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!