0

Every time it takes two clicks on the submit button to get the code to go, also just randomly it was triggering different codes that are setup the same way but with different names for the input and inside the $_POST. Am I using the $_POST right by setting the name of the input to the same thing?

here is the code

<?php                       
//If submit form was clicked
if(isset($_POST['intro'])) {
    //Server side validation for security purposes
    if($userpoints >= 100 AND $intro == 0 AND $lifeonmarsalbum == 0) {
        mysqli_query($con,"UPDATE users SET points = points - 100 WHERE users.user_name = '$username' LIMIT 1");
        mysqli_query($con,"UPDATE users SET intro = 1 WHERE users.user_name = '$username' LIMIT 1");
    }
}
?>
<form method="post" action="index.php">
    <?php
    if ($userpoints >= 100 AND $intro == 0 AND $lifeonmarsalbum == 0) {
        echo '<input type="submit" name="intro" value="100pts">';
    } elseif ($intro == 1 OR $lifeonmarsalbum == 1) {
        echo '<input type="submit" name="submit" value="100pts" disabled title="You already earned this track!">';
    } else {
        echo '<input type="submit" name="submit" value="100pts" disabled title="You need at least 100 points for this download">';
    }
    ?>
4

1 に答える 1