Javascript 表单提交时未提取jQuery中的输入值
我已经准备好了所有的资料。我所需要做的就是将它们保存在我的数据库中。但当我点击submit时,没有收到任何数据。我的所有数据都是使用Javascript 表单提交时未提取jQuery中的输入值,javascript,php,jquery,html,codeigniter,Javascript,Php,Jquery,Html,Codeigniter,我已经准备好了所有的资料。我所需要做的就是将它们保存在我的数据库中。但当我点击submit时,没有收到任何数据。我的所有数据都是使用.append()从我的js文件生成的 这是我的HTML文件: <table> <?php $attributes = array('class' => 'form form-horizontal', 'id' => 'receiving-form', 'role' => 'form', 'method' => 'PO
.append()
从我的js文件生成的
这是我的HTML文件:
<table>
<?php
$attributes = array('class' => 'form form-horizontal', 'id' => 'receiving-form', 'role' => 'form', 'method' => 'POST');
echo form_open('oss/admin/save_receiving', $attributes);
?>
<tbody>
<tr id="batch-no-data">
<td colspan="4" class="text-center">No data yet.</td>
</tr>
</tbody>
</table>
<?php echo form_close(); ?>
<div class="col-md-6 text-right">
<button id="add_ExpenseRow" class="btn btn-lg btn-info">Add</button> <button type="submit" form="receiving-form" class="btn btn-lg btn-info">Save</button>
</div>
我错过了什么?我不想使用Ajax,所以我真的想让表单提交工作
非常感谢您的帮助。谢谢 从输入中删除
disabled
属性,disabled
字段不会被表单拾取
batch_row = "<tr><td><input form='receiving-form' name='batch_no' class='form-control show_disabled' type='text' value='"+$('#last-batch-no').val()+"' id='batch_no-"+batch_ctr+"' /></td><td><input name='batch_date' form='receiving-form' class='form-control show_disabled' type='text' value='"+currentDate+"' id='batch_cur_date-"+batch_ctr+"'/></td><td><input form='receiving-form' name='batch_qty' id='qty-"+batch_ctr+"' class='form-control show_disabled' type='text' value='"+$('#receiving-box-table tbody>tr').length+"' /></td><td></td></tr>";
batch_row=“tr”).length+“/>”;
这现在应该可以用了。updated@T.J.Crowder!:)作为旁白,你可能想使用$batch\u no=html\u escape($this->input->post(“batch\u no”);在所有输入上使用html\u escape()@Brad。谢谢!Right@Riaz Laskar!但它不应该是可编辑的。我查看了一下,并用
readonly
替换了禁用的。Life saver!
public function save_receiving() {
// Batch data
$batch_no = $this->input->post('batch_no');
$batch_date = $this->input->post('batch_date');
$batch_qty = $this->input->post('batch_qty');
$batch_data = array(
'staff_id' => $staff_id,
'batch_no' => $batch_no,
'quantity' => $batch_qty
);
print_r($this->input->post()); die();
}
batch_row = "<tr><td><input form='receiving-form' name='batch_no' class='form-control show_disabled' type='text' value='"+$('#last-batch-no').val()+"' id='batch_no-"+batch_ctr+"' /></td><td><input name='batch_date' form='receiving-form' class='form-control show_disabled' type='text' value='"+currentDate+"' id='batch_cur_date-"+batch_ctr+"'/></td><td><input form='receiving-form' name='batch_qty' id='qty-"+batch_ctr+"' class='form-control show_disabled' type='text' value='"+$('#receiving-box-table tbody>tr').length+"' /></td><td></td></tr>";