Attachment file is not showing in email inbox php mail

i am using php mail function to send the attachment file, i want to display attachment file in inbox of email account, but my variable $data where i fetch details related to attached file, is empty.please help me to showing attachment file in email inbox.
Below is my code.

$data = chunk_split(base64_encode(file_get_contents($data)));
i fetched data in $data variable.

send_mail.php


<?php

    if (isset($_POST('email'))) {
        $email = $_POST('email');
        $mobile = $_POST('mobile');
        
        $fname = '';
        if(isset($_POST('fname'))){
        $fname = $_POST('fname');
        }
        
        
        $lname = '';
        if(isset($_POST('lname'))){
        $lname = $_POST('lname');
        }
        
        $candidate_name = '';
        if(isset($_POST('candidate_name'))){
        $candidate_name = $_POST('candidate_name');
        }
        
        
        $questions = '';
        if(isset($_POST('questions'))){
        $questions = $_POST('questions');
        }
        
        $apply_for = '';
        if(isset($_POST('apply_for'))){
        $apply_for = $_POST('apply_for');
        }
        
        $experience = '';
        if(isset($_POST('experience'))){
        $experience = $_POST('experience');
        }
        
        $candidate_message = '';
        if(isset($_POST('candidate_message'))){
        $candidate_message = $_POST('candidate_message');
        } 
        
        $data = '';
        if(isset($_FILES)){
                $file_name = $_FILES('my_file')('name');
                $temp_name = $_FILES('my_file')('tmp_name');
                $file_type = $_FILES('my_file')('type');
                $path_parts = pathinfo($file_name);
                $ext = $path_parts('extension');
                
                    $semi_rand = md5(time());
                    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
                    $file = fopen($_FILES('my_file')('tmp_name'), "rb");
                    $data = fread($file, filesize($_FILES('my_file')('tmp_name')));
                    fclose($file);
                    //$data = chunk_split(base64_encode($data));
                    $data = chunk_split(base64_encode(file_get_contents($data))); 
                    $name = $_FILES('my_file')('name');
                    
                      /*  $message .= "Content-Type: {"application/octet-stream"};n" . " name="$name"n" .
                            "Content-Disposition: attachment;n" . " filename="$name"n" .
                            "Content-Transfer-Encoding: base64nn" . $data . "nn";
                    $message .= "--{$mime_boundary}n"; */
            }
        
         $body = '<html>
                    <head>
                        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        <title>Cross Hudson Plastic Surgery</title>
                    </head>
                    <body>
                        <div style="background: #f1f1f1 none repeat scroll 0 0; display: inline-block; min-height: 100vh; width: 100%; font-size:14px;">
                            <div style="font-family: arial;  background: #f5f5f5 none repeat scroll 0 0; border-radius: 5px; box-sizing: border-box; display: table; margin: 30px auto;max-width: 800px;min-width: 400px;  width: 100%;">
                               <div style="background: #333 none repeat scroll 0 0;border-bottom: 1px solid #dfdfdf; margin-bottom: 30px; text-align: center;">
                                    <img style=" margin: 20px 0; max-width: 267px;" src="https://www.devoint.com/images/logo.png">
                                </div>
                                <div style="margin: 0 auto; padding: 10px 50px 22px; font-size: 15px;">
                                    <p style="color: #5f5f5f; line-height: 1.6;">Details has given below :-</p>
                                    <p style="color: #5f5f5f; line-height: 1.6;">
                                            <b>Email : </b>' . $email . '
                                       </p>
                                       <p style="color: #5f5f5f; line-height: 1.6;">
                                            <b>mobile Number: </b>' . $mobile . '
                                       </p> 
                                        ';
                                        
                                        if($fname != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b>First Name : </b>' . $fname . '
                                           </p>';
                                        }
                                        if($lname != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b>Last Name : </b>' . $lname . '
                                           </p>';
                                        }
                                        
                                        if($candidate_name != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b>Candidate Name : </b>' . $candidate_name . '
                                           </p>';
                                        }
                                        
                                         if($questions != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b>Questions : </b>' . $questions . '
                                           </p>';
                                        }
                                         if($apply_for != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b>Apply For : </b>' . $apply_for . '
                                           </p>';
                                        }
                                        if($experience != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b>Experience : </b>' . $experience . '
                                           </p>';
                                        }
                                        if($candidate_message != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b> candidate_message : </b>' . $candidate_message . '
                                           </p>';
                                        } 
                                        if($data != ''){
                                            $body .= '
                                            <p style="color: #5f5f5f; line-height: 1.6;">
                                                <b> filename : </b>' . $name . '<br>
                                                <b> Attachment : </b>' . $data . '
                                           </p>';
                                        }
                                         $body .='                                   
                                </div>
                                <div style="background: #333 none repeat scroll 0 0; padding: 9px 30px;text-align: center;">
                                    <p style="color: #fff; line-height: 1.5; font-size:13px;">
                                        Copyright &copy; ' . date("Y") . ' Devoint IT Solutions
                                    </p>
                                </div>
                            </div>
                        </div>
                    </body>
                </html>';
        $to = 'email@gmail.com';
        $from = 'Contact@gmail.com';
        if(isset($_POST('userName'))){
            $subject = "Have some questions?";
        }
        else{
            $subject = "Candidature form";
        }
        
        //$subject = "New Contact Form Submitted";
        // To send HTML mail, the Content-type header must be set
        $headers = 'MIME-Version: 1.0' . "rn";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
        $headers .= "Content-Type: multipart/mixed; boundary="" . $semi_rand . """ . "rn";
        // Additional headers
        $headers .= 'To: ' . $to . "rn";
        $headers .= 'From: ' . $from . "rn";
        // Send the email
        $page = $_SERVER('HTTP_REFERER');
        if (mail($to, $subject, $body, $headers)) {
            echo '<div class="alert alert-success alert-dismissible"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Success!</strong>Your details has been submitted successfully! We will contact you soon.</div>';
            die;
        } else {
            echo '<div class="alert alert-danger alert-dismissible"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Alert!</strong> Something went wrong!</div>';
            die;
        }
    }
    ?>