当推送到url时,表单样式不会保持大写


form style doesn't stay uppercase when pushed to url

我有一个搜索框,在某一点上取消了它,在某一点上我有这个工作,但不记得我在哪里找到它),我想推这个post变量,我希望它一直保持大写,直到最后一页,但它变成了小写。

代码
<?php
if (isset($_POST['u'])) {
    header ("Location: ./index.php?p=lookup&u=".$_POST['u']);
}
?>
<h2>Driver Search</h2>
<h3>* Are Required Fields</h3>
<div class="content">
<p>
<form id="searchform" method="post" action="">
<div>
*Driver Name: <input type="text" name="u" id="u" size="15" style="text-transform:uppercase;" />
<input type="submit" value="Search" />
</div>
</form>  
</p>
</div>

所以如果我搜索驱动程序"smoke",url仍然打印出index.php?p=lookup&u=smokeu

CSS样式text-transform: uppercase只影响文本在页面上的样子,而不是的实际值

如果你需要值全大写,你可以在PHP代码中调用strtoupper

如果您更担心它在创建的URL中的外观,则必须使用JavaScript在键入时或在提交表单之前更改值。