All this code is written on the same page
<form method="post" action = "http://mypage.lhosting.info/login/" >
<p> Username: <input type="text" name = "username" /> </p><br>
<p> Password: <input type="text" name = "password" /></p> <br>
<input type="submit" name="submit" value="Register" />
</form>
if(isset($_POST['submit']) && !empty($_POST['submit']))
{
$username = mysqli_real_escape_string($conn, $_POST['username']);
$password = mysqli_real_escape_string($conn, $_POST['password']);
$sql = "INSERT INTO Duomenys (Username, Password) VALUES ('$username','$password')";
}
The if(isset($_POST['submit']) && !empty($_POST['submit']))
does not trigger, it sends the account's details to my database everytime I refresh the page. What am I doing wrong?
Note: Still learning PHP and WordPress