Combine forms

Combine forms

Hello,

I'm trying combine 2 forms if requirement is met..

Basically we have contact form and newsletter. We need to clone the email and name values unto the newsletter form if the user opts-in to subscribe to it, and when he/she clicks submit, the contact form will be sent and the newsletter as well.. but if he unchecks the checkbox, only contact form will be sent..kind of vice versa.. below is the html, but I don't know where to begin..thank you..

  1. <form action="contact.php" method="post">

    <input type="text" name="f_name" required="required" id="f_name" placeholder="Name">
    <input type="text" name="email" required="required" id="email" placeholder="Email">
    <textarea name="message"></textarea>
    <input type="checkbox" name="newsletter">Subscribe to Newsletter
    <input type="submit" id="cbutton">
    </form>

    <!-- newsletter form -->
    <form action="newsletter.php" method="post" style="display:none">

    <input type="text" name="n_name" id="n_name" >
    <input type="text" name="n_email" id="n_email">

    <input type="submit" id="nbutton">

    </form>