我在表单中有一些禁用的输入,我想将它们发送到服务器,但Chrome会从请求中排除它们.
没有添加隐藏字段,有没有解决方法?
<form action="/Media/Add">
<input type="hidden" name="Id" value="123" />
<!-- this does not appear in request -->
<input type="textbox" name="Percentage" value="100" disabled="disabled" />
</form>
Run Code Online (Sandbox Code Playgroud) 有没有办法(使用属性标志或类似的东西)启用禁用提交数据的表单字段?
或者,如果那是不可能的,有没有办法阻止字段使用css或任何其他属性进行编辑而不是隐藏它们?
我的特殊情况是一个数据集的标识符,应该以表格形式显示(不可编辑) - 如果没有更好的解决方案,我想我会使用一个隐藏字段,除了被禁用的字段以保持实际显示它的已禁用值.
你好,我有一些投入,但他们中的一个被禁用(是,我需要为我的时间表),但我怎么把它给autocomplete.php我insert.php已经这个错误未定义指数:用C客户端1:\ WAMP \第30行的www\testlp\insert.php
这是我的代码autocomplete.php
<form action = 'insert.php' method="post" >
<input type="text" name="client1" class = "client" size="12" id ="client1" disabled />
</form>
Run Code Online (Sandbox Code Playgroud)
这里是我的代码insert.php
session_start();
$date = $_POST['data'] ;
$client1 = $_POST['client1'] ;
echo($client1);
echo($date);
Run Code Online (Sandbox Code Playgroud)
编辑 我试过这个:
<input type="text" name="client1" class = "client" size="12" id ="client1"readonly />
Run Code Online (Sandbox Code Playgroud)
这里的错误: Notice: Undefined index: client1 in C:\wamp\www\testlp\insert.php on line 12