I have the following code and I'm trying to update all the changes at once. But it did not work. Someone please help me!


        $clock = $_POST['clock'];
        $id = $_POST['days_id'];
            'dayweek_id' => esc_html($id),
            'opend_closed' => esc_html($clock)

        $wpdb->update( $table_days, $post_data, array( 'dayweek_id' => $id ), $format = null, $where_format = null );
<form class="wmtp-form-info" action="" method="post" enctype="multipart/form-data">
        echo '<input type="hidden" name="days_id" id="days_id" value="'.esc_attr($info->dayweek_id).'" />';
        $get_data_dayweek = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $table_days"));
        foreach ($get_data_dayweek as $info) {
            echo $dayoftheweek;
            echo '<select name="clock">'; ?>
              <option value="<?php echo $opend_closed; ?>" <?php echo (isset($_SESSION['clock']) && $_SESSION['clock'] == $opend_closed) ? "selected" : "" ?> hidden><?php echo $opend_closed; ?></option>
              <option value="true"> Opened</option>
              <option value="false"> Closed</option>
        <?php } ?>
<?php echo '<input class="button button-primary" type="submit" id="" name="updateDays" value="'.esc_html__('Update', $domain).'">'; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.