下拉列表中的PHP onchange = this.form.submit() - >第一个值丢失

时间:2022-09-25 16:21:00

I use Codeigniter Framework and there I use the dorm_dropdown.

我使用Codeigniter Framework,在那里我使用dorm_dropdown。

  <?php echo form_dropdown('wptypes', $wpstatuses, set_value('wptypes'), 'id="wptypes" class="form-select" onchange="this.form.submit()'); ?>

This is my code and when I add the onchange function then the first value of my options get lost. Without onchange everything is working. Why is this so?

这是我的代码,当我添加onchange函数时,我的选项的第一个值就丢失了。没有改变一切正常。为什么会这样?

Thank you and sorry for my bad english :)

谢谢你,抱歉我的英文不好:)

1 个解决方案

#1


2  

it is because you are missing the closing double quote of the onchange event.

这是因为你错过了onchange事件的结束双引号。

try it like this:

试试这样:

<?php echo form_dropdown('wptypes', $wpstatuses, set_value('wptypes'), 'id="wptypes" class="form-select" onchange="this.form.submit()"'); ?>

#1


2  

it is because you are missing the closing double quote of the onchange event.

这是因为你错过了onchange事件的结束双引号。

try it like this:

试试这样:

<?php echo form_dropdown('wptypes', $wpstatuses, set_value('wptypes'), 'id="wptypes" class="form-select" onchange="this.form.submit()"'); ?>