我用php编程,读取数据库数据,该字段是带空格的字符串。读取成功后,赋值给 text文本框的value. 结果显示出来,空格后的字符都被浏览器忽略了。求帮助。 例如,有个字段叫work title. 内容可能是General Manager, RD Engineer等。 我把他们读取出来的时候,设置文本框value。就只显示General. 或者RD. 空格 后的东西都没有了。html代码里面可以看到,浏览器把空格后面的东西都当做html 元素了。代码如下 <form name="input" action="update.php" method="get"> <input type="hidden" name="upid" value=<?php echo "$up_id";?>> Firstname : <input type="text" name="upfirst_name" value=<?php echo "$f_na";?>> Lastname : <input type="text" name="uplast_name" value=<?php echo "$l_na";?>><br> Worktitle : <input type="text" name="upwork_title" value=<?php echo $w_ti; ?>> Cell number: <input type="text" name="upcell_number" value=<?php echo "$c_num";?>> Email Add : <input type="text" name="upemail_add" value=<?php echo "$e_ml";?>> <input type="submit" value="update"> </form> 实际网页代码 <form name="input" action="update.php" method="get"> <input type="hidden" name="upid" value=3> Firstname : <input type="text" name="upfirst_name" value=Jack> Lastname : <input type="text" name="uplast_name" value=Huang><br> Worktitle : <input type="text" name="upwork_title" value= Vice General Manager(***General Manager被识别为和html标签一样的颜色,网页不显示*) > Cell number: <input type="text" name="upcell_number" value=13981888111> Email Add : <input type="text" name="upemail_add" value=Jack.huang@example.com> <input type="submit" value="update"> </form>
The actual effect is as follows. It should be a very simple problem, but it has not been solved. Originally, it was read from the database first, and then written back if it needed to be updated. But I wanted to update my phone number and not my work title, so I didn’t follow him. It turned out that I was a general manager before, but after updating my phone number, my work title became general.