AJAX更改的字段不经过提交
我有一个表单,在添加 AJAX 后停止发送一些字段值。
<select name="showId" id="showId" onChange="getClasses('findclasses.php?showId='+this.value)">
<option value="">Select a Show</option>
<?
$sql = "select * from shows order by ShowName";
$result = mysql_query($sql);
while ($show = mysql_fetch_array($result)) { ?>
<option value="<?=$show['Id']?>"><?=$show['ShowName']?></option>
<? } ?>
</select>
<div id="classdiv"> //contents reconstructed with AJAX when the show changes above
<select id="classId" name="classId">
<option value="">Select Class</option>
</select>
</div>
当节目更改时,将调用 AJAX 函数,并且 classdiv 的内容将替换为另一个具有与节目关联的类的选择字段(也称为 classId)。
单击提交后,我检查了 $_POST 变量,classId 不在列表中,但其他表单字段在列表中。关于为什么以及如何解决它的任何想法?
I have a form that stopped sending some field values after I added AJAX to the mix.
<select name="showId" id="showId" onChange="getClasses('findclasses.php?showId='+this.value)">
<option value="">Select a Show</option>
<?
$sql = "select * from shows order by ShowName";
$result = mysql_query($sql);
while ($show = mysql_fetch_array($result)) { ?>
<option value="<?=$show['Id']?>"><?=$show['ShowName']?></option>
<? } ?>
</select>
<div id="classdiv"> //contents reconstructed with AJAX when the show changes above
<select id="classId" name="classId">
<option value="">Select Class</option>
</select>
</div>
When the show changes, an AJAX function is called, and the contents of the classdiv are replaced with another select field (also named classId) that has the classes associated with the show.
After I click submit, I checked the $_POST variable, and classId was not in the list but the other form fields were. Any ideas on why and how to fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请检查一下,当classdiv的内容被ajax替换时,所有带有select标签的选项是否有不同的值?
Please check that when the contents of classdiv are replaced by ajax the all the option with select tag having their different values or not?