<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Domain checker</title> <link rel="stylesheet" href="./style.css"> </head> <body> <div id="wrapper"> <form method="POST"> <input type="text" name="domain" <?php if(isset($_POST['domain'])) echo 'value="'.$_POST['domain'].'"' ?>> <button type="submit">Check</button> </form> <div class="result"> <?php if(isset($_POST['domain'])){ if ( gethostbyname($_POST['domain']) == $_POST['domain'] ) echo "<p class='success'>Congatulations! {$_POST['domain']} is available</p>"; else echo "<p class='failur'>Sorry, {$_POST['domain']} is not available</p>"; } ?> </div> </div> </body> </html>