简体   繁体   中英

PHP onchange=this.form.submit() on dropdown -> First value get lost

I use Codeigniter Framework and there I use the 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?

Thank you and sorry for my bad english :)

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

try it like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM