0

I have a really really big problem with my isset $_GET. I have a website where I created some sort of question page, and people can spam it.

For example, after I fill all the fields in my question page, I press Submit. When the page is loading if I again press Submit, in my database will appear 2 rows with answers from questions. If I press 5 times it will be 5 rows.

I tried to do something but it doesn't seem to work.

The button:

<a href="?X=<?php echo $tid; ?>"><button type="button" class="btn btn-danger">Submit!</button></a>

My script:

<?php

include("connect.php");

$anti = 0;
if($anti == 0)
{
    $anti = 1;
    if(isset($_GET['X']))
    {

            $id = (int)$_GET['X'];


            mysql_query("INSERT INTO questions (1, 2, 3, 4, 5) VALUES ('q1', 'q2', 'q3', 'q4', 'q5')");

            //and other mysql_queries here...


            header("location: index.php");
    }
}

include("header.php");

?>

How else should I approach this issue?

Nate Barbettini
  • 51,256
  • 26
  • 134
  • 147

0 Answers0