else{
echo "Password should not be empty";
die();
}
i want to hide a button
here is the full code using mysql data with phpmyadmin on online server (not localhost)
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <form> <input type="button" onclick="location.href='/question1.php';" value="Go to question1" id="button"> </form> </body> </html> <?php
$username = filter_input(INPUT_POST, 'username');
$password = filter_input(INPUT_POST, 'password');
if (!empty($username)){
if (!empty($password)){
$host = "------";
$dbusername = "------";
$dbpassword = "------";
$dbname = "-----";
// Create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
if (mysqli_connect_error()){
die('Connect Error ('. mysqli_connect_errno() .') '
. mysqli_connect_error());
}
else{
$sql = "INSERT INTO account (username, password)
values ('$username','$password')";
if ($conn->query($sql)){
echo "";
}
else{
echo "Error: ". $sql ."
". $conn->error;
}
$conn->close();
}
}
else{
echo "Password should not be empty";
die();
}
}
else{
echo "Username should not be empty";
die();
}
?>
so can i add a javascript or anything to hide when username or password is empty?