I created a HTML form and gave it the action of my php file and the method of post.
HTML:
<form action="Data.php" style="position: fixed; top: 60px; left: 5px;" method="POST">
<fieldset>
<legend>Create Account</legend>
Username: <br>
<input type="text" name="username">
<br>
Email:<br>
<input type="text" name="email">
<br>
Password:<br>
<input type="text" name="password">
<br><br>
<input type="submit" value="Create">
</fieldset>
</form>
And i get the data from the form into this php file:
<?php
// retrieve the form data by using the element's name attributes value as key
$email = $_POST['email'];
$username = $_POST['username'];
$pass = $_POST['password'];
$conn = mysqli_connect("localhost:3306", "mysql.default_user", "mysql.default_password");
$db = mysqli_select_db("UserInfo", $conn);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO Users (email, passwrd, username) VALUES ('".$email."', '".$pass."', '".$username."')";
$result = mysqli_query($conn, $sql);
$conn->close();
?>
and the php is supposed to send it to an sql server i made in Microsoft sql Server Management and i connected the server to vs code, which is where im doing all of my coding.