Button Link, HTML Code to Append a code to a URL and redirect |
Button Link, HTML Code to Append a code to a URL and redirect |
kpomilla |
Feb 1 2019, 12:50 PM
Post
#1
|
Group: Members Posts: 1 Joined: 1-February 19 Member No.: 26,812 |
Hi, I would like to place a textbox on my web page, along with a button below it. Once a user enters text and clicks the button, have it go to that link.
For example, they are provided a random 8 letter code, which is actually the last part of a URL. http://mysite.com/whfysnes But instead of providing the full link, I'd like them to go to http://mysite.com, have a textbox where they can enter "whfysnes" and click GO to link them to the url. I know, it seems easier to just give them the full link, but this is what I need to accomplish. Any thoughts? That is what my client wants... I have a snippet of html code, but when I use it, it tries to redirect to http://mysite.com/?page=whfysnes where whfysnes is where I want to go. (http://mysite.com/whfysnes). <form action="/" method="get"> <p><label>Go to<input name="page" type="text" /></label></p> <p><input type="submit" value="Go" /></p> <p> </p> <p> </p> </form> Top Thanks in advance for any help. |
Darin McGrew |
Feb 1 2019, 01:49 PM
Post
#2
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
You cannot do what you want with HTML.
The most reliable method would be to configure your server to respond to .../?page=whfysnes (possibly by redirecting .../?page=whfysnes to /whfysnes ). JavaScript could be used to intercept the form submission, and rewrite the URL. But once the URL .../whfysnes gets out there (and there are multiple ways that can happen), browsers can access it directly rather than go through the form. That's not really an issue for a toy system, but if you need real security, then it's inadequate. |
Lo-Fi Version | Time is now: 29th March 2024 - 01:35 AM |