"."/> ".">
Home > Article > Backend Development > How to set input read-only in php
How to set input read-only in php: 1. Open the corresponding code file; 2. Set input read-only through "36083b1ab81036845ce56f354dfd93cd".
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
php How to set input read-only?
Detailed explanation of the input attribute in PHP (hide read-only restriction)
Hide
e5462c768f5798a05e7960bb43e965e1
readonly
36083b1ab81036845ce56f354dfd93cd
Disabled
6d716f27f21ca08ec9fe5dd2ffdc0cbd
Restrictions
9bd912d309623976fc4e57530a5f892f
ENTER key moves the cursor to the next input box
<input onkeydown="if(event.keyCode==13)event.keyCode=9">
Shield input method
<input type="text" name="url" style="ime-mode:disabled" onkeydown="if(event.keyCode==13)event.keyCode=9">
There are two ways to achieve the read-only effect of input: disabled
and readonly
.
Of course the two effects can only be read but not edited, but they are very different.
Disabled indicates that the input is invalid and its value will not be passed to any program, such as asp, PHP, etc.
Readonly only cannot be edited and does not affect the transfer of its value.
Disabled use:
<INPUT type=”text” name=”username” value=”james” disabled> Readonly使用: <INPUT type=”text” name=”partNumber” value=”1500″ readonly>
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to set input read-only in php. For more information, please follow other related articles on the PHP Chinese website!