I have tried the following code but it does not work.
Code
<?php
if (!empty($_POST)) {
$mysqli = new mysqli('localhost', 'root', '123', 'users');
if ($mysqli->connect_error) {
die( 'Connect Error: ' . $mysqli->connect_errno . ': ' . $mysqli->connect_error );
}
$sql = "INSERT INTO users ( username, email ) VALUES ( '{$mysqli->real_escape_string($_POST['username'])}', '{$mysqli->real_escape_string($_POST['email'])}' )";
$insert = $mysqli->query($sql);
if ($insert) {
echo "Success! Row ID: {$mysqli->insert_id}";
} else {
die("Error: {$mysqli->errno} : {$mysqli->error}");
}
$mysqli->close();
}
?>
<form action="main.php" method="post">
<input type="text" id="SIMOMO" name="username" minlegth="5" maxlength="30" class="pad" required>
<input type="text" ID="FLOBIT"name="email" class="pad" required >
<input type="submit">
</form>