为了账号安全,请及时绑定邮箱和手机立即绑定

性别按钮有问题,没有被选中

<?php

require_once '../include.php';

$id = $_REQUEST['id'];

$sql="select id,username,password,email,sex from imooc_user where id='{$id}'";

$row = fetchOne($sql);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title here</title>

</head>

<body>

<h3>添加用户</h3>

<form action="doAdminAction.php?act=editUser&id=<?php echo $id;?>" method="post" enctype="multipart/form-data">

<table width="70%" border="1" cellpadding="5" cellspacing="0" bgcolor="#cccccc">

<tr>

<td align="right">用户名</td>

<td><input type="text" name="username" placeholder="<?php echo $row['username'];?>"/></td>

</tr>

<tr>

<td align="right">密码</td>

<td><input type="password" name="password" value="<?php echo $row['password'];?>"/></td>

</tr>

<tr>

<td align="right">邮箱</td>

<td><input type="text" name="email" placeholder="<?php echo $row['email'];?>"/></td>

</tr>

<tr>

<td align="right">性别</td>

<td>

<input type="radio" name="sex" value="1"  <?php echo $row['sex']=="男"?"checked='checked'":null;?>/>男

<input type="radio" name="sex" value="2" <?php echo $row['sex']=="女"?"checked='checked'":null;?>/>女

<input type="radio" name="sex" value="3" <?php echo $row['sex']=="保密"?"checked='checked'":null;?>/>保密


</td>

</tr>


<tr>

<td colspan="2"><input type="submit"  value="编辑用户"/></td>

</tr>


</table>

</form>

</body>

</html>


正在回答

3 回答

你看看你数据表里面的枚举类型是addUser里的参数吗?

0 回复 有任何疑惑可以回复我~

数据库里面的性别是乱码就会导致这样的问题,cmd进入数据库后加上一行 default charset=utf8;

0 回复 有任何疑惑可以回复我~

我也是这个问题。。明明代码都是一模一样的。。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
手把手教你实现电商网站后台开发
  • 参与学习       117283    人
  • 解答问题       1999    个

手把手教你用PHP搭建电子商务平台,由浅入深教你搭建电商系统

进入课程

性别按钮有问题,没有被选中

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信