I have a settings page like ...
add_options_page ( 'XXX', 'XXX', 'manage_options', 'xxx_plugin', 'xxx_options_page' );
function xxx_options_page() { ?>
<div class="wrap">
<h2><?php _e('XXX Settings', 'xxx'); ?> </h2>
<form action="options.php" method="post">
<?php settings_fields('xxx_plugin_options'); ?>
<?php $options = get_option('xxx_options'); ?>
<?php $t = xxx_get...; ?>
<table class="form-table">
<select name='xxx_options[foobar]'>
<?php foreach($t as $key => $value) { ?>
<option value='<?php echo $key ?>' <?php selected($key, $options['xxx']); ?>><?php echo $value ?></option>
<?php } ?>
</select>
// ... more elements, submit-button, ...
</form>
<?php } ?>
I need to add another select-element, thoose values depends on the selection of the first select-element.
For example: First select-element: Select Country -> Second select element: Select states of selected country -> Third select element: Select cities of selected state.
I think, I cannot do this without Ajax, but I did not found some matching example or an tutorial how to do that with WP and Ajax. Any ideas? Any examples? TIA!
Aucun commentaire:
Enregistrer un commentaire