React Component Nesting and Reusability Explained – A Beginner's Guide 2026

Image
1. Introduction to React Component Nesting and Reusability React JS is a popular JavaScript library used to create interactive and user-friendly web applications. One of the most useful concepts in React development is component-based architecture. Instead of writing an entire website inside one large file, developers divide the user interface into smaller and manageable parts called components. Two important concepts in this approach are component nesting and component reusability. Component nesting means placing one React component inside another component to build a complete user interface. For example, a website page may contain a header, navigation bar, sidebar, content section, and footer. Each section can be developed as a separate component and combined inside a main component. Component reusability means creating a component once and using it multiple times in different parts of an application. For example, the same button, product card, or navigation menu can be reused withou...

registration form in php

    PHP Registration form 

registration form in php


Registration Form

(USE TO HTML LANGUAGE)

Example ::-




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="
width=device-width, initial-scale=1.0">
    <title>Document</title>
  </head>
<body class="">
   
        <form action="index.php" method="post">
            <h1>Register Here</h1>
      <label>Name</label>
    <input type="text" name="unm" required><br>

       <label>Mobile No</label> <input
type="text" name="umob" required><br>

            <label>Email Address</label>
  <input type="email" name="uem" required><br>

            <label>Password</label>
 <input type="password" name="upwd"required><br>


           <select class="form-control mt-2"
name="uque" required>
                <option disabled selected>
--select sequrity Quetion--</option><br>
               
                <option class=
"What is your hobby?">What Is Your Hobby ?
</option>
            <option class="What is your
favourite color?">What is your
Favourite color?</option>
        <option class="What is your School
name?">What is your School name?</option>
        </select><br>

       
        <label>Answer</label>
        <input type="text" name="uans"
class="form-control " required> <br>
     

       

        <input type="submit" value="Register"
        name="b1">
       
        <a href="login.php" >
            Already Have an Account?</a>
   
    </form>
    </div>
   
</body>
</html>

Registration Form

Output

registration form (use html) output

Registration Form 

Example ::-

(Use to Bootstrap language )


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet"
href="css/bootstrap.css">
</head>
<body class="">
    <div class="col-md-4 bg-white shadow-lg
mx-auto mt-4 p-3">
        <form action="index.php" method="post">
            <h1 class="text-primary">Register
Here</h1>
            <label>Name</label>
            <input type="text" name="unm"
class="form-control" required>

            <label>Mobile No</label>
            <input type="text" name="umob"
class="form-control" required>

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

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


           <select class="form-control mt-2"
name="uque" required>
                <option disabled selected>
--select sequrity Quetion--</option>
               
                <option class="
What is your hobby?">What Is Your Hobby ?
</option>
            <option class="What is your
favourite color?">What is your Favourite color?
</option>
        <option class="What is your School
name?">What is your School name?</option>
        </select>

       
        <label>Answer</label>
        <input type="text" name="uans"
class="form-control " required>
     

        <div class="text-center mt-2">

        <input type="submit" value="Register"
        class="btn btn-primary" name="b1">
       
        <a href="login.php" class="btn
btn-danger">
            Already Have an Account?</a>
    </div>
    </form>
    </div>
   
</body>
</html>

Registration Form

(Use to Bootstrap language )

Output::-

Registration form (use to bootstrap) output

Registration Form 

(Use  PHP language)
Example :-


<?php
include 'connection.php';

    if(isset($_POST['b1']))
    {
       $name = $_POST['unm'];
       $mob = $_POST['umob'];
       $email = $_POST['uem'];
       $pass = $_POST['upwd'];
       $que = $_POST['uque'];
       $ans= $_POST['uans'];

       $qS="SELECT * FROM userdetails
WHERE uem = '$email'";
      // echo $qS;
      $rs = mysqli_query($cn,$qS);
      $count = mysqli_num_rows($rs);
      //echo $count;
        if($count == 1)
        {
            echo "<script>
            alert('Username Already Exist');
            </script>";
        }

        else
        {
            $qI="INSERT INTO userdetails
(unm,uem,upwd,umob,uque,uans)
            VALUES('$name','$email','$pass'
,$mob,'$que','$ans')";
          //  echo $qI;

          if(mysqli_query($cn,$qI))
          {
            echo "<script>
            alert('Register Successfully');
            window.location.href='login.php';
            </script>";

          }

          else
          {
            echo "<script>
            alert('Failed To register');
            </script>";
          }
        }
    }

?>

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

        <h1 class=" text-center mt-3">
            <?php
        $qC ="SELECT count(uid) as x
FROM userdetails";
        $rsC=mysqli_query($cn,$qC);
        $dataC= mysqli_fetch_assoc($rsC);
       
            ?>
            Total Register User - <?php
echo $dataC['x']?>
        </h1>
   
        <div class="col-md-4 bg-white
shadow-lg mx-auto mt-5
        p-3">
           
          <h1 class="text-center text-primary">
                Register Here
            </h1>

        <form action="index.php" method="post">
            <label>Name</label>
            <input type="text" name="unm"
class="form-control mb-1"
            required>

            <label>Mobile No</label>
            <input type="text" name="umob"
class="form-control mb-1"
            required>

            <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>

            <select class="form-control mb-1"
name="uque" required>
                <option disabled selected>
                     --Select Sequrity
Quetion --
                </option>

           <option value="What is your Hobby">
What is your Hobby?</option>
        <option value="What is your Favourite
color">What is your
Favourite color?</option>
                <option value="What is your
School Name">What is your School Name?
</option>
            </select>

            <label>Answer</label>
            <input type="text" name="uans"
class="form-control mb-1"
            required>

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

                <a href="login.php" class="
btn btn-danger">Already Have an Account ?
</a>
            </div>
            </form>
        </div>
</body>
</html>

Registration Form 

Output ::- 

(output store in the database)

             1] you can create the database 
            2] php code to call the database name 
               for example ::- wallet is database name. 

<?php

$cn = mysqli_connect("localhost","root","",
"wallet");
?>

registration form php /output

registration form php use/output

MYSQL  OUTPUT 

registration form php use mysql /output


Related Post :-

html radio button

how to create login forms

php program to check whether a number is positive or negative

Comments

Popular posts from this blog

CSS Text Color Explained with Syntax and HTML Examples

CSS Outline Offset Property with Practical Examples

Learn CSS text-decoration-color Property in Simple Words with Examples