Welcome Guest, Not a member yet? Register   Sign In
refresh the page after clicking the button
#11

[eluser]mrcoder[/eluser]
no i dont want the same page to be updated after submitting the form.my page is editminiprofile page after clicking submit button it have to go to preview page.where the uploaded images have to display.iam not getting the images untill i refresh that page.if i used the redirect('loginsuccess',refresh) instead of $this->load->view('loginsuccess', $data,'refresh'); again i have to get the values of editminiprofile page.which will be the duplicate of the code.thats is the problem iam facing.
#12

[eluser]Yorick Peterse[/eluser]
[quote author="mrcoder" date="1250510986"]no i dont want the same page to be updated after submitting the form.my page is editminiprofile page after clicking submit button it have to go to preview page.where the uploaded images have to display.iam not getting the images untill i refresh that page.if i used the redirect('loginsuccess',refresh) instead of $this->load->view('loginsuccess', $data,'refresh'); again i have to get the values of editminiprofile page.which will be the duplicate of the code.thats is the problem iam facing.[/quote]

If the preview page is different from the editing page you could simply load the preview page's view file with different variables.
#13

[eluser]mrcoder[/eluser]
ya i have loaded the preview page’s view file with different variable.but iam not getting the reflected images untill i refresh the browser
#14

[eluser]bluepicaso[/eluser]
hello people..a problem im facing is related to the refreshing of the page.i haven't worked on CI before this is my first ever project most of which has to be completed by tomorrow to show to client..

The view submits the value to the controller, the controller passes it to the model.
The model saves it into the database....
the controller then redirects to the same view from which it all started...

But on refreshing the page the value still gets into the database...i dont want this.. is there a way to clear these post values....
below is the code....

View named admin_insert

Code:
<?php echo $sub;?>
                <?php echo form_open("insert/main_cat")?>
                    <table>
                        <tr>
                            <td>
                                Main Category
                            </td>
                            <td>
                                &lt;input type="text" name="cat"&gt;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &lt;input type="submit" value="Save"&gt;
                            </td>
                        </tr>
                    </table>
                &lt;?php form_close();?&gt;

controller named insert

Code:
&lt;?php
class Insert extends Controller
{
    function Insert()
    {
        parent::Controller();
    }
    function main_cat()
    {
        $cat = $this->input->post('cat');
        $this->load->model('insertmodel');
        $data['sub'] = $this->insertmodel->setCat($cat);
        if($data['sub'] == 1)
        {
            unset($_POST);
            $this->load->view('admin_insert', $data);
        }
        else
        {
           //--------data not inserted------------
           echo "Oops data is not inserted<br> Please go back and resubmit <br> OR <br> Try refreshing the page";
        }
        
    }
}
?&gt;
Model named insertmodel

Code:
&lt;?php
class insertModel extends Model
    {
    function insertModel()
    {
        parent::Model();
    }
        function setCat($a)
        {
            //$b = md5($b);
            $x = $this->db->query("insert into main (name) values ('$a')");
        return $x;
    }
    }
?&gt;




Theme © iAndrew 2016 - Forum software by © MyBB