php22

Curso de PHP🐘 y MySql🐬 [22.- Switch case]

En este tutorial vamos a aprender a usar la estructuras condicional switch case.

Codigo: https://github.com/programadornovato/php/commit/81428ac02c1226eadc497534cce830952980462f

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="bootstrap.min.css">
    <title>Login</title>
</head>

<body>
    <div class="container mt-2">
        <div class="row">
            <div class="col-12">
                <form method="post">
                    <div class="form-group">
                        <label>Email address</label>
                        <input type="email" class="form-control" name="email" placeholder="Email">
                    </div>
                    <div class="form-group">
                        <label>Password</label>
                        <input type="password" class="form-control" name="pass" placeholder="Password">
                    </div>
                    <button type="submit" class="btn btn-primary" name="enviar" value="enviar">Enviar</button>
                </form>
            </div>
        </div>
        <div class="row">
            <div class="col-12">

            <?php
                if(isset($_POST['enviar'])){
                    $email=$_POST['email'] ?? '';
                    $pass=$_POST['pass'] ?? '';

                    echo ($email=='[email protected]'  &&  $pass=='123456') ? alerta('Simon chavo ya entraste','primary') : alerta('Nel no pasas','danger');
                }
            ?>
            </div>
        </div>
    </div>
</body>

</html>
<?php
    function alerta($texto,$tipo){
        return "<div class=\"alert alert-$tipo\" role=\"alert\">$texto</div>";
    }
?>

? Esta lista de reproducción: https://www.youtube.com/playlist?list=PLCTD_CpMeEKS2Dvb-WNrAuDAXObB8GzJ0

Codigos en gdrive: https://drive.google.com/file/d/1tQwYvfL2jiUFc6beTWkOkGmXkq5zzFw2/view?usp=sharing
Gracias por apoyar este canal: https://www.patreon.com/programadornovato?fan_landing=true

? Facebook: https://facebook.com/ProgramadorNovatoOficial
? Twitter: https://twitter.com/programadornova
? Linkedin: https://www.linkedin.com/in/programadornovato/
? Instagram: https://www.instagram.com/programadornovato/

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *