How to include recieved token into a url wordpress - html

Ive made this very simple form:
<form action="http://xxxxxx.xxx/GetLoginToken.ashx?userName=USERNAME&password=PASSWORD" method="get" name="HentToken" target="_blank">
Username:<input name="USERNAME" type="text" />Password: <input name="PASSWORD" type="text" /><input type="submit" value="Submit" /></form>
It then returns a "token", or 20 digits, to my browser, and writes it in the browser.
Is there any way I can make it so that the token is included in a URL, and then open that URL instead of just writing the token to the browser window?
http://xxxx.xxx/Open.ashx?token=[TOKEN]
I'm not a programmer and I know this one is all to simple, but I'm totally lost.

Related

Html form get request not adding the form data

I'm making a desktop app that requires user to activate a key.
So the form here is making a get request to the api.
How do I make it so that when the user submits a form data (a key)
it is added as a parameter in the string?
UPDATE: Question answered.Thanks!
But can anyone tell me how to make it so if the key is valid, the software loads, but if not then it throws an exception?
<form method="get" formenctype="text/plain" action="https://app.cryptolens.io/api/key/Activate?token=blahblahblah&ProductId=xxx2&Key=" >
<input type="text" maxlength="23" size="80" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" />
</form>
I don't think you quite understand how GET works. Get sends data via the URI, any field(using the 'name' property) you add into your form is added to the query string.
<form method="get" formenctype="text/plain" action="https://app.cryptolens.io/api/key/Activate" >
<input type="text" name="token" maxlength="23" size="80" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" />
<input type="text" name="ProductId" maxlength="23" size="80" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" />
<input type="text" name="otherData" maxlength="23" size="80" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" />
</form>
This will produce: https://app.cryptolens.io/api/key/Activate?token=VALUE&ProductId=VALUE&otherData=VALUE
Note I also removed the query string from the ACTION="" As the request will do that automatically for you.
EDIT: I also wouldn't recommend having your token in plain view. Either you make it a hidden field or you use javascript to execute the request with some masking. Hidden is usually fine providing the API has the necessary security to handle it.
Using hidden inputs and naming them like the GET you need.
Check the name token with hidden value like example.
Remove all the GET from the action-url.
The final URL will be: https://app.cryptolens.io/api/key/Activate?Key=yourKey&token=blahblahblah&ProductId=xxx2
<form method="get" formenctype="text/plain" action="https://app.cryptolens.io/api/key/Activate" >
<input type="text" maxlength="23" size="80" name="Key" placeholder="XXXXX-XXXXX-XXXXX-XXXXX" />
<input type="hidden" name="token" value="blahblahblah" />
<input type="hidden" name="ProductId" value="xxx2" />
</form>

HTML E-mail form

So my site is almost done but I'm stuck on the part of sending an email.
Everything works, when I fill in the fields. But it always gets saved as a draft so I don't receive the email.
Here is my html code:
This code is copied from a site.
<form action="mailto:myemailadress#gmail.com" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name"><br>
E-mail:<br>
<input type="text" name="mail"><br>
Comment:<br>
<input type="text" name="comment" size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
action="mailto:myemailadress#gmail.com" <-- This is not correct.
You'll have to point your post submission to a handler php file that will process the form request and submit the email.
Now, some host providers do have a php mailer to make us things easier, e.g godaddy https://www.godaddy.com/es/help/using-our-php-form-mailers-on-web-and-classic-hosting-8376 .
An example of php mail handler for forms can be found here http://www.freecontactform.com/email_form.php . It has some validation code too.
There is a possibility that you're using a server that doesn't support PHP but ASP, .NET, Node.js or some other, in that case i can't help you because i'm not familiar to none of them :)

Redirect to selected site with variable which i got

<form action="/subsite/" method="GET">
<input type="text" name="" placeholder="Your Nick">
<input class="button" type="submit" />
</form>
I want to redirect I mean it should looks like
www/subsite/text
What should I use ? POST ?
The method="get" means that the parameters (and values) will be sent in the query string (the stuff after the question mark in the URL). eg.
/subsite?input_field_name=input_field_value
In your case, the input field doesn't have a name, which will cause problems. You probably want something like this:
<input type="text" name="nickname" placeholder="Your Nick">
So if you submit this form:
<form action="/subsite" method="get">
<input type="text" name="nickname" placeholder="Your Nick">
</form>
Then after submitting, the browser will go to:
/subsite?nickname=value_of_nickname_variable
If you use a method="post", then the form data (variables) will be sent along in the request body, not the query string. There are other differences between get/post, but that's one of them :)
If you just want to do a simple redirect when clicking the button, you could use javascript instead, eg.: window.location.href='/my_url_path_here'

Sending textbox inputs to email HTML

I'm working on a page where I have 2 textboxes.
I want to send the user inputs for these 2 mailboxes to my email but my code doesn't seem to work. Is there anything I've missed?
<form method="post" action="mailto:youremail#youremail.com" >
First:<input type="text" name="First" size="12" maxlength="12" />
Last:<input type="text" name="Last" size="24" maxlength="24" />
<input type="submit" value="Send Email" />
</form>
Your code is correct, it does work for me. It probably doesn't work for you because you don't have an email client, or your browser turns off this feature for security (or something like that). I would recommend that you use a service to perform this action such as http://www.braveapps.com/emailfwd/ or http://allforms.mailjol.net/.

Passing form variables through URL

What I want to accomplish is logging in to a website by simply typing in the form variables in the URL.
HTML code:
<form action="httpclient.html" onsubmit="return checkSubmit();" method="post" target="_parent" name="frmHTTPClientLogin">
<input type="hidden" name="mode" value="191">
<label>Username</label>
<input border="1" style="width:150px" maxlength="60" name="username">
<label>Password</label></pre>
<input type="password" border="1" style="width:150px" autocomplete="off" name="password" maxlength="60">
This is the relevant past of the code. Now I want to login to this site http://10.100.56.55/httpclient.html just by passing values typed in the url. Firstly is it possible. If yes then what exactly do i need to type for userame :name and password being pass ?
and what encoded URL will be passed in POST method if any?
Change method="post" to method="get"
If you want to type the Querystring in for the username and password, you need to do this in the address field of your browser:
http://10.100.56.55/?username=name&password=pass
EDIT:
You need to find out where the form is going and what it's doing. For this, you need to check what the submit javascript function called 'checkSubmit()' is doing. You can do this by opening the page in your browser and doing a view source. If the javascript is external to the html file, check the js links on the page and open those up to find that function. The function might have the querystring parameters you're looking for.
<input type="text" class="form-control" placeholder="Products" name="search" value="search" id="search">
<input type="text" class="form-control" placeholder="Products" name="search" value="search" id="search2">
<button type="submit" class="btn btn-default" onclick="location.href='\search.php?search='+ document.getElementById('search').value+'&search2='+document.getElementById('search2').value;"> Search</button>
the issue was in the input tag <input type="hidden" name="min_price" value="200"> forward slash was missing,I have added the forward slash and it works now <input type="hidden" name="min_price" value="200"/>.
It's not possible to do that; the form would have to use the GET method.