Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在此代码中使文本框为只读 名字:_Php_Html_Forms - Fatal编程技术网

Php 如何在此代码中使文本框为只读 名字:

Php 如何在此代码中使文本框为只读 名字:,php,html,forms,Php,Html,Forms,如果要使inputEmail成为只读字段,可以使用 <label class="control-label" for="inputEmail">First Name:</label> <div class="controls"> <input type="text" class="span4" id="inputEmail" name="firstname" value="<?php echo $row['firstname']; ?>"

如果要使inputEmail成为只读字段,可以使用

<label class="control-label" for="inputEmail">First Name:</label>
<div class="controls">
<input type="text" class="span4" id="inputEmail" name="firstname"  value="<?php echo $row['firstname']; ?>" placeholder="First Name" required>
<input type="hidden" id="inputEmail" name="id" value="<?php echo $get_id;  ?>" placeholder="First Name" required>     
名字:

如果要使文本字段仅可读,请使用readonly属性

一个例子:

<label class="control-label" for="inputEmail">First Name:</label>
<div class="controls">
<input type="text" class="span4" id="inputEmail" name="firstname"  value="<?php echo $row['firstname']; ?>" placeholder="First Name" required readonly>
<input type="hidden" id="inputEmail" name="id" value="<?php echo $get_id;  ?>" placeholder="First Name" required>  

来自您的代码

<input type="text"value="foo"readonly>
名字:

您希望将什么设置为只读#输入电子邮件?这里的问题是什么?如何将输入字段/文本区域设置为只读,已经有很好的文档记录。你只要看一下文档就知道答案了。这个问题还行。谢谢它起作用了。@jeanko,不客气!没问题。您可以通过选择一个答案并在其上打勾来结束问题。
<label class="control-label" for="inputEmail">First Name:</label>
<div class="controls">
<input type="text" class="span4" id="inputEmail" name="firstname"  value="<?php echo $row['firstname']; ?>" placeholder="First Name"readonly>
<input type="hidden" id="inputEmail" name="id" value="<?php echo $get_id;  ?>" placeholder="First Name" readonly>