Hello, please help me sold this issue. It can read the content on the MySql table but when I change the value on the input, then click on Submit, nothing is updated on the table. I don't know why.
<?php
global $wpdb, $current_user;
$user_id = get_current_user_id();
$sql = 'SELECT `slot`, `id` FROM ab_staff WHERE `wp_user_id` = "' . (int)$user_id. '"';
$member_slot = $wpdb->get_results( $sql );
$member_slot_1=$member_slot[0];
$d = get_object_vars($member_slot_1);
$member_slot_2= $d['slot'];
$member_slot_3= $d['id'];
?>
<?php
if(isset($_POST["submit"])) {
$slot_time = $_POST['member_slot'];
$command = "UPDATE ab_staff SET `slot` = '$slot_time' WHERE `id` ='$member_slot_3'";
$result = $wpdb->get_results($command);
}
print_r ($slot_time);
?>
<label class="control-label" for="ab-staff-member"><?php _e( 'Time Slot', 'ab') ?></label>
<form action="<?php $_PHP_SELF ?>" method="post">
<select id="member_slot" name="member_slot">
<option value="900" <?php if ( $member_slot_2 == 900) { echo 'selected=\"selected\"'; }; ?>>15 minutes</option>
<option value="1200" <?php if ( $member_slot_2 == 1200) { echo 'selected=\"selected\"'; }; ?>>20 minutes</option>
<option value="1800" <?php if ( $member_slot_2 == 1800) { echo 'selected=\"selected\"'; }; ?>>30 minutes</option>
<option value="2700" <?php if ( $member_slot_2 == 2700) { echo 'selected=\"selected\"'; }; ?>>45 minutes</option>
<option value="3600" <?php if ( $member_slot_2 == 3600) { echo 'selected=\"selected\"'; }; ?>>60 minutes</option>
</select>
<input name="submit" type="submit" value="<?php _e( 'Submit', 'xoousers' ); ?>">
</form>
</td>