【发布时间】:2012-10-09 07:00:26
【问题描述】:
我正在使用ajax 调用文件getattributes.php 并从该文件中附加一个包含一些复选框的表。它附加成功,但问题是当我提交表单时我没有得到值那些动态添加的字段。我也知道stackoverflow中有类似的问题,但我仍然遇到问题。
getattributes.php :-
<tr><th><?php echo($exquery['specification_name']);?></th>
<?php $getattribute = "SELECT * FROM attributes WHERE specification_id = '".$specifi_id[$i]."' ";
$executeattribute = mysql_query($getattribute);
while($attibutes = mysql_fetch_assoc($executeattribute))
{
$attributecount = $attributecount + 1;
?>
<td><input type='checkbox' value='<?php echo($attibutes['attribute_id']);?>' name='attribute_id<?php echo($i);?>[]'> <?php echo($attibutes['attribute_name']);?></td>
<input type='hidden' name = 'attribute_id<?php echo($i);?>[]' value='<?php echo($attibutes['attribute_id']);?>' id='spec<?php echo $i;?>attr<?php echo $attributecount?>'/>
<?php }?>
</tr>
<?php
$attributecount = 0;
?>
<!--<input type='hidden' name = 'test' value='<?php echo $attributecount;?>' id='spec<?php echo $i;?>'/>-->
<?php }
我还添加了显示它已成功附加到我的表单的快照:-
这里的规格表是动态添加的,我想获取品牌和颜色复选框的值。我不知道是什么问题。
编辑:-发布方法代码
<form method="POST" action="" enctype="multipart/form-data" class="myform">
// some field //
</form>
我正在使用 print_r($_POST) 检查帖子值,我得到了表单的所有值,但没有得到动态添加的字段值
提前致谢
【问题讨论】:
-
您需要发布一些处理 POST 的代码
-
我编辑了我的问题@Reinder
-
复选框中的值仅在提交前选中复选框时显示
-
选中复选框后我正在检查帖子值
-
那么你是如何检查这些值的呢?仅打印 $_POST 变量对于未选中的单选按钮没有多大作用...
标签: php jquery ajax forms post