一 代码
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<htmlxmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/>
-
<title>统一英文注册用户首字母大写</title>
-
</head>
-
-
<body>
-
<formname="form"method="post"action="#">
-
<label>用户名:</label>
-
<input type="text" name="name" id="name" value="<?php echo $_POST['name'];?>"><br>
-
<inputtype="submit"name="sub"value="提交"><p>
-
</form>
-
<?php下载
-
if(!empty($_POST['name'])){//判断文本框的值是否为空
-
$temp=ucfirst($_POST['name']);//把传过来的英文名的首字母变成大写
-
}
-
echo "首字母统一为大写:".$temp;//输出首字母统一为大写的用户名
-
?>
-
</body>
-
</html>
二 运行效果
![](https://i-blog.csdnimg.cn/blog_migrate/d8540eaa142705af120db36512a69259.png)
三 说明