【发布时间】:2015-04-20 14:20:03
【问题描述】:
我有一个表单页面,当我提交此表单时,所有输入都已成功发布,除了这个:
<input id="TC" class="form-control" name="kullanici_id" type="text" onchange="edit()"
<?php if($this->data['kullanici_id']){echo 'readonly';} ?>
value="<?php echo $this->data['kullanici_id']?>">
但是为什么呢?
-这是我的 .phtml 文件:
<html>
<head>
</head>
<body>
<form enctype="multipart/form-data" action="/admin/kaydet" method="post" onSubmit="javascript: beforeSubmit();">
<?php if(strlen($this->data['id'])):?>
<input type="hidden" name="id" value="<?php echo $this->data['id']?>">
<?php endif;?>
<font color="green"><h3>DÜZENLE</h3></font>
<img src="/foto/<?php echo $this->data['fotograf']?>" height="110" width="110" align="left" />
<table class="table">
<tr>
<td>T.C. Kimlik No.:</td>
<td><input id="TC" class="form-control" name="kullanici_id" type="text" onchange="edit()" <?php if($this->data['kullanici_id']){echo 'readonly';} ?> value="<?php echo $this->data['kullanici_id']?>"></td>
</tr>
<?php if(!strlen($this->data['id'])):?>
<tr>
<td>Parola:</td>
<td><input id="password2" class="form-control" type="password" name="parola" value="<?php echo $this->data['parola']?>"></td>
</tr>
<tr>
<td>Parola Tekrar:</td>
<td><input onchange="passwordCheck(this.value)" class="form-control" type="password" name="parola" value="<?php echo $this->data['parola']?>"></td>
</tr>
<?php endif; ?>
</table>
<td><button type="submit" class="btn btn-success btn-sm glyphicon glyphicon-floppy-disk">KAYDET</button> </td>
</form>
</body>
</html>
如果我有身份证;页面看起来像一个编辑成员页面,如果我没有的话;页面将添加一个新成员。在 id="TC" 输入中,如果我编辑一个成员,这个输入不应该改变,所以我添加了一个 readonly 来解决这个问题。但是当我提交时,输入不会发布。 对不起我的英语不好:D
【问题讨论】:
-
似乎该字段被设置为
readonly,因此任何更改都将被丢弃并发布到服务器。您可能想向我们展示实际帖子的样子。 -
请发布完整的源代码。
-
@IsaacKleinman 因为在给定的代码中有
readonly而不是disabled。所以肯定会处理的 -
您的输入是包含值还是为空?我的意思是,当您查看表单时,如果您看到一些价值 :-) 而且您是否正在尝试 var_dump() 整个帖子?
-
是你
<form>里面的输入吗?