How to stop the user sending post requests
<pre><code>    if($_POST)
    {

        if($this-&gt;session-&gt;userdata('just_sended'))
        {
            echo 'just sended';
            exit();

        }

        $newdata = array(
                   'just_sended'  =&gt; true

        );
        $this-&gt;session-&gt;set_userdata($newdata);
    }
    else
    {
        $newdata = array(
                   'just_sended'  =&gt; false
        );
        $this-&gt;session-&gt;set_userdata($newdata);

    }
</code></pre>

<p>This is my code when the user send a post request, but i can't figure it out why it not works, the user spams the button "send" and in my database appears duplicates, any ideas?</p>
