I'm making a "Input select option" in Custom Metabox for my plugin, I'm not Expert in PHP I don;t know How to Save user "Input select option". Working perfectly plain PHP.
public function zon_featuress_boxx( $post ) {
wp_nonce_field( 'zonpackk_testimonial', 'zonpackk_testimonial_nonce' );
$data = get_post_meta( $post->ID, '_zonpackk_testimonial_key', true );
$dataoption = isset($data['dataoption']) ? $data['dataoption'] : '';
?>
<?php
if (isset($_POST['dataoption'])) {
$page = $_POST['dataoption'];
$_SESSION['dataoption'] = $page;
} else {
$page = $_SESSION['dataoption'];
}
?>
<form name="myform" action="" method="post">
<select name="dataoption" onchange="this.form.submit()">
<option value="page1"<?php if ($page == "page1") {
echo " selected";
} ?>>Page 1
</option>
<option value="page2"<?php if ($page == "page2") {
echo " selected";
} ?>>Page 2
</option>
</select>
</form>
<?php
switch ($page) {
case 'page2':
echo "string2";
break;
case 'page1':
echo "string1";
break;
}
?>