Input saved to a file and then submitted to the URL on submit

99 Views Asked by At

I have a form. Right now it has one action and simply just submits the inputs to URL. I would like it to be modified where when the form is completed the inputs are saved to a file and then submitted to the URL.

<form class="snp-subscribeform snp_subscribeform" action="join.cgi" method="post">
    <input name="page" type="hidden" value="1" />
    <div>
        <input id="snp-firstname" class="snp-field snp-field-firstname " name="firstname" required="" type="text" value="" placeholder="Enter Your First Name" />
        <input id="snp-lastname" class="snp-field snp-field-lastname " name="lastname" required="" type="text" value="" placeholder="Enter Your Last Name" />
        <input id="snp_email" class="snp-field snp-field-email" name="email" type="text" placeholder="Enter Your Email " />
        <input id="snp-password" class="snp-field snp-field-password " name="password" required="" type="text" value="" placeholder="Select A Password" />
    </div>
    <div>
        <input class="snp-subscribe-button snp-submit" type="submit" value="CONTINUE" data-loading="Creating Account!" data-success="Account Created!" />
    </div>
</form>
</div>
1

There are 1 best solutions below

1
On

You would need to use javascript and the onclick event for the submit button to retrieve the values from the DOM elements you are interested in and save them to the file.

Here is a sample of how to get started:

<input type="submit" name="submit" value="Save" onclick="writedata()" />

<script>
    function writeData() {
    }
</script>