• hi
    i try to make plugin to a slider
    i make alredy an admin panel, and i can update the db.
    but i’v a problem after i put the new data and press update – its update the db, but it not shown on the page.
    i nead to refresh the admin page page and only after that i see the change.

    how i can automaticly can refresh the page?
    code` <h1>Slider Table</h1>
    <form action=”” method=”post”>
    <?php
    for($i=1; $i<=5; $i++)
    {
    $sliderows=getSliderData($i);
    echo ‘<div id=”single-slide-wrap”>
    <div id=”slide-num”>
    <p id=”stitle”><strong>#’.$i.'</strong></p>
    <input name=”slideradio” type=”radio” value=”‘.$i.'” />
    </div><!–slide-num–>
    <div id=”slide-pic”>
    <img alt=”” src=”‘.$sliderows[‘img’].'” style=”width: 120px; height: 80px;” />
    </div><!–slide-pic–>
    <div id=”slide-text”>
    <strong>Img Url: </strong>’.$sliderows[‘img’].'<br />
    <strong>Title: </strong>’.$sliderows[‘title’].'<br />
    <strong>Url: </strong>’.$sliderows[‘url’].'<br />
    </div><!–slide-text–>

    </div><!–single-slide-wrap–>’;
    }
    ?>

    <h3>update Slider</h3>

    IMAGE URL: <input type=”text” name=”img” />
    TEXT: <input type=”text” name=”text” />
    URL: <input type=”text” name=”url” />
    <input type=’submit’ name=”submit” value=’update’ />
    </form>

    <?php

    if(isset($_POST[‘submit’]))
    {
    if(isset($_POST[‘slideradio’]))
    {
    switch($_POST[‘slideradio’]) {
    case ‘1’:
    update_slider_db(1);
    break;
    case ‘2’:
    update_slider_db(2);
    break;
    case ‘3’:
    update_slider_db(3);
    break;
    case ‘4’:
    update_slider_db(4);
    break;
    case ‘5’:
    update_slider_db(5);
    break;
    }

    }

    }
    `

Viewing 1 replies (of 1 total)
  • Thread Starter DUKEiLL

    (@dukeill)

    i found the answer:

    i insert the code:
    header("location: " . $_SERVER['REQUEST_URI']);
    into update_slider_db function
    and add:

    //allow redirection, even if my theme starts to send output to the browser
    add_action(‘init’, ‘do_output_buffer’);
    function do_output_buffer() {
    ob_start();
    }

    into function.php

Viewing 1 replies (of 1 total)
  • The topic ‘How refresh page after updating a DB ?’ is closed to new replies.