我有一个数据库,用于存储当前文本输入的输入:
<input type="text" name="fullname" class="form-control" value="<?php echo $fullname; ?>" required>
是否可以在每篇作品中大写第一个字母,所以如果用户输入James bond
或james bond
,输出将为James Bond
?
我了解style="text-transform: capitalize;"
,但是据我了解,这只会更改显示的字母,但是表单数据中的实际数据仍将是用户输入的字母。
答案 0 :(得分:0)
ucwords()是您要寻找的东西。
https://www.php.net/manual/en/function.ucwords.php
<input type="text" name="fullname" class="form-control" value="<?php echo ucwords($fullname); ?>" required>