I don't know what I'm doing wrong but it's not inserting the data I want it to put into the database. No code error is being given to me except the one that I have created mysql such as the 'Error Inserting' and stuff like that. I also have done lots of a Google searches about login sources and try to see what the difference is but it's no use. I can't find what's wrong! Please help.
<?php
include_once('connect.php')
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
if (isset($_POST['dalol'])){
test();
}
function test(){
$sql = "INSERT INTO members (username, email, password) VALUES ('".$GLOBALS['username']."','".$GLOBALS['email']."','".$GLOBALS['password']."')";
if (mysql_query($sql)){
echo '<p>Successfully Executed!</p>';
} else {
echo '<p>Failed!</p>';
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Insert Test</title>
</head>
<body>
<form>
Username: <input type="text" name="username"/><br>
Email: <input type="email" name="email"/><br>
Password: <input type="password" name="password"/><br>
<input type='submit' name='dalol'/>
</form>
</body>