Site icon Hip-Hop Website Design and Development

How do I ship kind submissions to a file utilizing WordPress?

I’ve created a customized HTML kind with textual content inputs and a checkbox. I need the enter information to be despatched to a file that retains monitor of all consumer submissions.

This code works exterior of WordPress, however does nothing after I put it in a WordPress file.

if(isset($_POST['submit'])){
            if((!isset($_POST['fname'])) || (!isset($_POST['lname'])) || (!isset($_POST['consent']))){
                $error = "*" . "Please fill all the required fields.";
            }
            else{
                $information = $_POST['fname'] . ' ' . $_POST['lname'] . ' ' . $_POST['consent'] . "n";
                $fp = fopen('C:Usersfilesnew.txt', 'a');
                fwrite($fp, $information);
                fclose($fp); 

            }
        }

How can I do that in WordPress?
Thanks in your assist!