Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97313

My PHP file wont insert HTML data into a MySql database table

$
0
0

In Visual Studio Code, i am working on creating a website. An HTML page i have has a form that gets the user data...

<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" name ="Submit" value="Create">
    </fieldset>
</form> 

it then sends it to a php file called Data.php...

<?php
if(isset($_POST['Submit'])){
    $host = "localhost:3306";
    $username = "Arthos";
    $password = "Pancake101!";
    $database = "userinfo";

    $user = $_POST['username'];
    $email = $_POST['email'];
    $pass = $_POST['password'];

    $connect = mysqli_connect($host, $username, $password, $database);
    $query = "INSERT INTO 'users'('username', 'email', 'password') VALUES ("'.$user.'", "'.$email.'", "'.$pass.'")";

    $result = mysqli_query($connect,$query);

    mysqli_close($connect);
}
?>

and i do not have a clue how to view php echos or mysql errors in vs code considering i am using a base html project and they are not appearing in the debug console. I can send what the data base looks like if it is needed.


Viewing all articles
Browse latest Browse all 97313

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>