Hello,

This is my case:
- In file abc.php, I have mentionned two other file as two tabs (tab1.php and tab2.php). Their links are: abc.php#tab1 and abc.php#tab2
- On tab2.php, I have a form:

<form action="" method="POST">
<select name="slot" id="slot">
<option value="1">
<option value="2">
<option value="3">
</select>
<input type="submit" value="Update" name="submit">
</form>
  • On abc.php, I place the update code:

    <?php
    global $wpdb;
    if(isset($_POST['submit']))
    {
    $slot_new=$_POST['slot'];
    $command = "UPDATE ab_slot SET slot = '$slot_new' WHERE id = 1";
    $result = $wpdb->get_results($command);
    echo "<p>Updated</p>";
    }
    ?>

However, it don't work :(

And, how to do stay on abc.php#tab2 after click on Update button?

Please help me!

Member Avatar for diafol

Choosing a tab to display on page load will be down to the js code you're using - of which you make no mention.

Are we to assume that your tabs have something like this?

<div id="tab1">
<? include 'tab1.php' ?>
</div>
<div id="tab2">
<? include 'tab2.php' ?>
</div>

Too little info posted with original question. Try again.

We have the code structure like that:

   <div class="tabbable">
        <ul class="nav nav-tabs ab-nav-tabs">
            <li class="active"><a id="ab-staff-details-tab" href="#tab1" data-toggle="tab"><?php _e( 'Details', 'ab' ) ?></a></li>
            <li><a id="ab-staff-services-tab" href="#tab2" data-toggle="tab"><?php _e( 'Services', 'ab' ) ?></a></li>
            <li><a id="ab-staff-schedule-tab" href="#tab3" data-toggle="tab"><?php _e( 'Schedule', 'ab') ?></a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane" id="tab1">
                <div id="schedule-container" class="ab-staff-tab-content" style="display: none"></div>
            </div>
            <div class="tab-pane" id="tab2">
                <div id="holidays-container" class="ab-staff-tab-content" style="display: none"></div>
            </div>
        </div>
    </div>

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.