I am wanting to submit a webform with the values of the textbox that are entered by a user.
Now I am using an API of a webservice and I cannot find it in their documentation on how to do this.
The form I am making is a signup form and the submit URL will have the username and password displayed in them so that the API can parse them and create an account.
How do I get the value of the textbox from the form straight away in the url when I click on the submit button??
The URL is like this:
https://readitlaterlist.com/v2/signup?username=name&password=123&apikey=yourapikey
The username=name => where name needs to be the value of the username textbox
The password=123 => where 123 needs to be the value of the password field.
The url will be passed to the system in the background and will never be visible to the user, so the data is not exposed and therefore save.
Thanks in advance.
The code for the form is:
<form id="login" action="https://readitlaterlist.com/v2/signup?username=name&password=123&apikey=em8p5F73A5bs6h0ZmYg5d21E37d5S424">
<div id="usernameTB" class="textbox"><input id="username" type="text" placeholder="Username" autofocus required></div>
<div id="passwordTB" class="textbox"><input id="password" type="password" placeholder="Password" required></div>
<div id="buttonSubmit" class="button"><input type="submit" id="submit" value="Sign up"></div>
</form>
Since there is a secret api key involved, and you require that it is not exposed to the user, you have to do it(calling api) on your server.
So,
Let user submit a form with username and password to your server. Using server side scripting, make a note of username and password and call the api using respective tool available for your server side script. In php you can use
cURL. In asp.net you can useWebRequest. You can find something for every server side scripting language.If you do it on client side, the api key inevitably will fall into the hands of malicious user and you will end up with lots of accounts.