I have a choice menu in WordPress plug-in with ddslick . I want to pass the id of the selected option and send the form to a database , but the value is not saved although it appears within the html . When put into manual is well maintained.
<script type='text/javascript' src='http://g-page.co.il/wp-content/themes/g-page/js/jquery.ddslick.min.js'></script>
<div id="myDropdown">
<select id="demo-htmlselect">
<?php
$thumbnails = get_posts('numberposts=5');
foreach ($thumbnails as $thumbnail) {
$url = wp_get_attachment_url( get_post_thumbnail_id($thumbnail->ID) );
?>
<option value="<?php echo $thumbnail->ID;?>" data-imagesrc="<?php echo $url; ?>"
data-description="<?php echo $thumbnail->post_title;?>"><?php echo $thumbnail->post_title;?></option>
<?php } ?>
</select>
</div>
<?php
?>
<div class="wrap">
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<input type="text" name="main_art_id" size="45" value="<?php echo get_option('main_art_id'); ?>" />
</p>
<p><input type="submit" name="Submit" value="Store Options" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="ain_art_id" />
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#myDropdown').ddslick({
onSelected: function(selectedData){
var cor_val = selectedData['selectedData']['value'];
$("input[name=main_art_id]").val(cor_val);
}
});
});
</script>
<?php
}