Send data from html form to php file that will send it to email in cpanel

i got regular form with name, email and message , when submit button is pressed i want to send that data to email, i know i can send it with php file, i found this code on youtube enter image description here

i want to change $to=(mail entered in form) , $message=(from form), $name(from form). how do i pass those data from html file

this is what my for looks like in html.

<form id="survey-form">
                    <div class="form-group">
                      <label id="name-label" for="name">Name</label>
                      <input
                        type="text"
                        name="name"
                        id="name"
                        class="form-control"
                        placeholder="Enter your name"
                        required
                      />
                    </div>
                    <div class="form-group">
                      <label id="email-label" for="email">Email</label>
                      <input
                        type="email"
                        name="email"
                        id="email"
                        class="form-control"
                        placeholder="Enter your Email"
                        required
                      />
                    </div>
                    <div class="form-group">
                      <label id="number-label" for="phnumber"
                        >Phone</label
                      >
                      <input
                        name="fphone"
                        id="phnumber"
                        placeholder="number"
                      />
                    </div>
                    <div class="form-group">
                      <p style="color: white; font-family:'Quantico',monospace ;">Text us</p>
                      <textarea
                        id="comments"
                        class="input-textarea"
                        name="comment"
                        placeholder="Your message..."
                      ></textarea>
                    </div>
                
                    <div class="form-group">
                      <button type="submit" id="submit" class="submit-button">
                        Submit
                      </button>
                    </div>
                  </form>

what should i write in script in html file and how would i rewrite that php code to make it work ?(if there is better way to do it let me know)