TMQ à cái đó thì dễ thôi tạo 1 form nhập thông tin sau đó
if (isset($_POST["pam"])) {
if (empty($_POST["host"])) $error .= "<p>- Bạn quên nhập ServerName.</p>";
if (empty($_POST["name"])) $error .= "<p>- Bạn quên nhập database name.</p>";
if (empty($_POST["user"])) $error .= "<p>- Bạn quên nhập username.</p>";
if (empty($error)) {
$PAM_connect = new mysqli($_POST["host"], $_POST["user"], $_POST["pass"], $_POST["name"]);
if ($PAM_connect->connect_error) {
$error = $PAM_connect->connect_error;
} else {
// chuyển hướng trang khi kết nối thành công
header("Location: /");
}
}
}
Còn Muốn nó chuyển nút sang màu đỏ thì dùng ajax là đc