Here is my sql:
<?php
$db=pg_connect("host=localhost port=5432 dbname=postgres user=postgres password=preethy1970");
if (isset($_POST['signup'])) {
$query = "INSERT INTO users(user_name,user_password,user_email,user_phone,user_type) VALUES('$_POST[name1]','$_POST[password]','$_POST[email]','$_POST[phoneNumber]','$_POST[usertype]')";
$result=pg_query($query);
}
?>
And here is the html:
<form method="post" action="signUp.php">
<input id="submit-form" name="name1" placeholder="Name" type="text" required></input>
<input id="submit-form" name="email" placeholder="Email id" type="email"></input>
<input id="submit-form" name="phoneNumber" placeholder="Phone Number" type="tel"></input>
<input id="submit-form" name="password" placeholder="Password" type="password"></input><br>
<input name="usertype" type="radio" value="0">Student</input>
<input name="usertype" type="radio" value="1">Faculty</input>
<input name="usertype" type="radio" value="2">Alumni</input>
<input id="submit-btn" type="submit" name="signup" value="Sign Up"></input>
</form>
So I'll go to my signup page and add some contents, which will be added into the users table. When I reload the page, even though the fields are empty and the submit button is not clicked, the previous contents are added as a new row again. Why is this happening?