Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

how to create login form in php

        

     how to create login form in php 

Registration form  in php






Login Form 

      EXAMPLE :-




<?php
include 'connection.php';
        if(isset($_POST['b1']))
        {
           
            $email = $_POST['uem'];
            $pass = $_POST['upwd'];
    $q="SELECT * FROM userdetails WHERE uem =
'$email' AND upwd ='$pass'";

            $rs = mysqli_query($cn,$q);
            $count = mysqli_num_rows($rs);

                if($count ==1)
                {
                    session_start();//start
            $data = mysqli_fetch_assoc($rs);
                   
      $_SESSION['id'] = $data['uid'];//create
                    echo "<script>
                    alert('login Successfully');
          window.location.href='profile.php';
                    </script>";
                }
                else
                {
                    echo "<script>
                  alert('Invalid Credetials');
                    </script>";
                }

        }

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content=
"width=device-width, initial-scale=1.0">
    <title>User Login</title>
    <link rel="stylesheet"
href="css/bootstrap.css">
</head>
<body class="">

       
   
  <div class="col-md-4 bg-white shadow-lg
mx-auto mt-5
        p-3">
           
        <h1 class="text-center text-primary">
                Login Here
            </h1>

      <form action="login.php" method="post">
           

            <label>Email Address</label>
<input type="email" name="uem" class="
form-control mb-1"
            required>

            <label>Password</label>
            <input type="password" name="upwd"
class="form-control mb-1"
            required>

         
            <div class="text-center">
          <input type="submit" value="Login"
           name="b1" class="btn btn-primary">

  <a href="index.php" class="btn btn-danger">
Create An account ?</a>


                <br>

                <p class="text-center my-3">
                    <a href="forgot-password.php">
                        forgot password ?
                    </a>
                </p>
            </div>
            </form>
        </div>
</body>
</html>

Login Form 


         Output:-

           PHP FORM (USE TO BOOTSTRAP)/output

Note :- data store in the database php


Related Post :-


php program factorial number program

php program to print alphabet pattern B

php for loop

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example