ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Input user data to complete URL using only HTML

(1/2) > >>

questorfla:
This might be simpler that I am showing below but the idea is to allow a user to complete a URL link and go there.

My best arrangement only works insofar as it doesn't crash.
A lot of the info below could even be deleted and it still 'works' to get to oracle but nothing i have tried can take the input from the user and add it to the href statement.

Any info appreciated even if it means using a completely alternative method as long as it Looks and works as intended. (and is short :) )


--- ---<!DOCTYPE html>
<html>
<body>
     <form name ="gotourl" action=" " method="post"
     <p> Enter Final Word Here -
     <input type="text" name="fword"
     <br><br>
     <a href="https://www.oracle.com/"fword>”CLICK to go”</a>
     </form-name>
</body>
</html>
Example would be if you want to go to:
https://www.oracle.com/sun

But you only wanted the use to enter the word "sun" in the box displayed  Typing it in the box and clicking the work "click to go" just goes to oracle.com and the "sun" subdirectory does not get added.

Something like this would probably be proper using a lot of PHP but I was hoping for a simpler HTML version to add an input to a line of code and go there.

Since I admittedly don't how to do it, there may well be one
 :(

4wd:
Seemed to work here OK:


--- Code: HTML5 ---<HTML>  <HEAD>    <SCRIPT LANGUAGE="JavaScript">      function goToPage(form) {        var initial = "http://www.oracle.com/";        var extension = ".html";        var newurl = initial + form.subpage.value + extension;        window.location.assign(newurl);      }    </SCRIPT>    <TITLE>Redirect Test</TITLE>  </HEAD>  <BODY>    <P>    <FORM name="form" action="" method="GET">      Input word:       <INPUT type="text" name="subpage" value="">      <INPUT type="button" Name="button" value="GO" onClick="goToPage(this.form);">    </FORM>  </BODY></HTML>

questorfla:
Only one minor edit and 4WD saved the day again!   :Thmbsup:
As below, I only added '/index' to var in your code so the page opens in the browser. !perfect!

I was trying to skimp too much      :-[
I was hoping to get by using the "form" setup by itself but could not manage the last bit whether I used "get" or "post" or ??

You are a Lifesaver!  >>as usual   8)
Hope you enjoyed a Great Christmas PLUS 'Boxing Day'  :)
Us poor Yanks only get Christmas :(   
uhm ...Well Plus
New Years Day

and of course

 INAUGURATION DAY! 

 


--- ---<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
      function goToPage(form) {
        var initial = "http://www.oracle.com/";
        var extension = "/index.html";
        var newurl = initial + form.subpage.value + extension;
        window.location.assign(newurl);
      }
    </SCRIPT>
    <TITLE>Redirect Test</TITLE>
  </HEAD>
  <BODY>
    <P>
    <FORM name="form" action="" method="GET">
      Input word:
      <INPUT type="text" name="subpage" value="">
      <INPUT type="button" Name="button" value="GO" onClick="goToPage(this.form);">
    </FORM>
  </BODY>
</HTML>

mouser:
Just wanted to say it's great to see people helping each other out on little projects like this  :up:

questorfla:
Just wanted to say it's great to see people helping each other out on little projects like this  :up:
-mouser (January 19, 2017, 11:44 AM)
--- End quote ---

Thanks Mouser:  DC has been my 100% ALL TIME BEST site for "goTo" help.
The "other guys"  don't come close.   :Thmbsup:

Navigation

[0] Message Index

[#] Next page

Go to full version