we have taken the data and put it into database using php and also done with searching data , the only problem we are facing here is when we hit update button after searching data , we are getting Notice as
Notice: Undefined index: FromD in C:\xampp\htdocs\bkc\update-search.php on line 130
Notice: Undefined index: ToD in C:\xampp\htdocs\bkc\update-search.php on line 131
Notice: Undefined index: Contact in C:\xampp\htdocs\bkc\update-search.php on line 132
Notice: Undefined index: Child in C:\xampp\htdocs\bkc\update-search.php on line 136
and we are losing our FromD , ToD , Contact , Child data from database and getting message "Updation Failed" after hitting update button
NOTE:
- FromD, ToD, Contact are text and Child is number/integer 
- Other is info. is updating Successfully with message "Data Updated" 
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Search and Update</title>
    <style>
        .align{
            align:center;
        }
        .grad1 {
            height: 600px;
            background-color: red; 
            background-image: linear-gradient(315deg,#F6BB45, #18AA99);
            border-radius:20px;
            color:white;
        }
        
        .container{
            margin: 10px 50px 50px 50px;
        }
      </style>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>
    
    <div class="container grad1 text-center">
        <h1>Update Reservation Details</h1>
        <form action="" method="POST"> 
            <div class="form-group ">
                <label for="exampleInputEmail1"><h5>Email address</h5></label>
                <input type="email" class="form-control " name="email" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email to Search">
            </div>
            <!--
            <div class="form-group">
                <label for="exampleInputPassword1"><h5>Password</h5></label>
                <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
            </div>
            -->
            <button type="submit" class="btn btn-warning" name="search" value="Search Data"><h5>Search</h5></button>
          </form>
        <?php
          $conn = mysqli_connect("localhost","root","");
          $db = mysqli_select_db($conn,"booking");
          if(isset($_POST['search']))
          {
            $email = $_POST['email'];
            
            $query = "SELECT * FROM bookingt where email='$email' ";
            $query_run = mysqli_query($conn,$query);
            while($row = mysqli_fetch_array($query_run))
            {
                ?>
                    <form action="" method="POST">
                        <div class="form-group">
                            <br>
                            <h4>Your Details:</h4>
                            <p><b>Email:</b>
                            <input type ="hidden" name="Email" value="<?php echo $row['Email'] ?>"/>
                            <b>Name:</b>
                            <input type ="text" name="Name" value="<?php echo $row['Name'] ?>"/></p>
                            <p><b>Source:</b>
                            <input type ="text" name="Source" value="<?php echo $row['Source'] ?>"/>
                            <b>Destination:</b>
                            <input type ="text" name="Destn" value="<?php echo $row['Destn'] ?>"/></t>
                            <b>From:</b>
                            <input type ="text" name="From-D" value="<?php echo $row['FromD'] ?>"/>
                            <b>To:</b>
                            <input type ="text" name="To-D" value="<?php echo $row['ToD'] ?>"/></p>
                            
                            <p><b>Contact:</b>
                            <input type ="text" name="contact" value="<?php echo $row['Contact'] ?>"/>
                            <b>Bus:</b>
                            <input type ="text" name="Bus" value="<?php echo $row['Bus'] ?>"/>
                            <b>Class:</b>
                            <input type ="text" name="Class" value="<?php echo $row['Class'] ?>"/></p>
                            <p><b>No. of adults:</b>
                            <input type ="number" name="Adult" value="<?php echo $row['Adult'] ?>"/>
                            <b>No. of childs:</b>
                            <input type ="number" name="child" value="<?php echo $row['Child'] ?>"/>
                            <b>No. of Uchilds:</b>
                            <input type ="number" name="Uchild" value="<?php echo $row['Uchild'] ?>"/></p>
                        </div>
                        <button type="submit" class="btn btn-danger" name="update" value="Update Data"><h5>Update</h5></button>
                    </form>
                <?php
            }
          }
        $conn->close();
        ?>
    </div>
</body>
</html>
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
try{
    $conn = mysqli_connect("localhost","root","");
    $db = mysqli_select_db($conn,"booking");
}   catch(Exception $ex)    {
    echo "Error";
}
function getPosts()
{
    $posts = array();
    $posts [0] = $_POST['Name'];
    $posts [1] = $_POST['Source'];
    $posts [2] = $_POST['Destn'];
    $posts [3] = $_POST['FromD'];
    $posts [4] = $_POST['ToD'];
    $posts [5] = $_POST['Contact'];
    $posts [6] = $_POST['Bus'];
    $posts [7] = $_POST['Class'];
    $posts [8] = $_POST['Adult'];
    $posts [9] = $_POST['Child'];
    $posts [10] = $_POST['Uchild'];
    $posts [11] = $_POST['Email'];
    return $posts;
}
if(isset($_POST['update']))
{
    $data = getPosts();
    $update_Query = "UPDATE `bookingt` SET `Source`='$data[1]',`Destn`='$data[2]',`Bus`='$data[6]',`Class`='$data[7]',`Adult`='$data[8]',`Child`='$data[9]',`Uchild`='$data[10]',`FromD`='$data[3]',`ToD`='$data[4]',`Name`='$data[0]',`Contact`='$data[5]' WHERE `Email`='$data[11]' ";
    try{
        $update_Result = mysqli_query($conn, $update_Query);
        if($update_Result)
        {
            if(mysqli_affected_rows($conn) > 0)
            {
                echo "Data Updated !!!";
            }
            else
            {
                echo " Updation Failed";
            }
        }
    }   catch(Exception $ex){
        echo "Error Update ".$ex->getMessage();
    }
}
$conn->close();
?>
 
     
     
    