select option update/save a variable via get_option/update_option


I try to make inside theme custom admin panel a switch select option. but i cannot get the value of switch case. I think i did totally wrong.

<?php if(isset($_POST['wphw_submit'])){
function wphw_opt(){
    $bannerchange = $_POST['bannerchange'];
    global $chk;
    if( get_option('bannerchange') != get_option($bannerchange)) {
        $chk = update_option( 'bannerchange', get_option($bannerchange));
if(isset($_POST['wphw_submit']) && $chk): endif;?>
<form method="post" action="">
<select name="wphw_submit" onchange="this.form.submit()">
    <option value="page1"<?php if ($bannerchange == "page1") { echo " selected"; } ?>>Custom Departure</option>
    <option value="page2"<?php if ($bannerchange  == "page2") { echo " selected"; } ?>>Fixed Departure</option>
<input type="submit" name="wphw_submit" value="Save changes" class="button-primary" /></form>
switch ($bannerchange) { 
    case 'page2': 
    case 'page1':
        break; } 

$bannerchange get always undefined. I can debug this problem with straight way? any help greatly appreciated.

Noufal Binu 3 months 0 Answers 9 views 0

Leave an answer