Submit button not working on first click
<p>I have tried many different things and I can't seem to figure out why the submit button doesn't work on the first click. I have removed the if statements from the code and still it takes two clicks. On the first click it refreshes the page which is the most obvious when you click on a submit button that you have to scroll down to. The code below is repeated about 27 times on the page but with different songs. All of them work after the second click so I'm pretty sure they are connected correctly. Also when you click on the button once and then if you click on a different one it submits the first one you clicked on.</p>

<p>I have setup a test account on the page if somebody wants to see what it actually looks like. <a href="http://www.saint57records.com/rewards/index.php" rel="nofollow">http://www.saint57records.com/rewards/index.php</a> Username: test Password: test</p>

<pre><code>&lt;?php
$resultstwo = mysqli_query($con,"Select * FROM users WHERE user_name ='$username'");
while ($row = mysqli_fetch_array($resultstwo))
{
extract($row);
}
?&gt;
&lt;form method="post" action="index.php"&gt;
  &lt;?php
    //If submit form was clicked
    if(isset($_POST['endo'])) {
        //Server side validation for security purposes
       if($points &gt;= 100 AND $endo == 0 AND $savetheworldalbum == 0) {
            mysqli_query($con,"UPDATE users SET points = points - 100 WHERE users.user_name = '$username' LIMIT 1");
            mysqli_query($con,"UPDATE users SET endo = 1 WHERE users.user_name = '$username' LIMIT 1");
        }
    }
    if ($points &gt;= 100 AND $endo == 0 AND $savetheworldalbum == 0) {
        echo '&lt;input type="submit" name="endo" value="100pts"&gt;';
    } elseif ($endo == 1 OR $savetheworldalbum == 1) {
        echo '&lt;input type="submit" name="submit" value="100pts" disabled title="You already earned this track!"&gt;';
    } else {
        echo '&lt;input type="submit" name="submit" value="100pts" disabled title="You need at least 100 points for this download"&gt;';
    } 
  ?&gt;
&lt;/form&gt;
</code></pre>

<p>This is what that outputs</p>

<pre><code>&lt;form method="post" action="index.php"&gt;
&lt;input type="submit" name="endo" value="100pts"&gt;&lt;/form&gt;                                                    
</code></pre>
