dare87 Posted October 27, 2009 Share Posted October 27, 2009 I want to place a text box on a webpage so that you can place information in the box and then when you hit submit it will forward you to www.domainl.com/TEXTBOXINFO Is Javascript the best way to do that. Also I want to "hide" the url so that it doesn't look like the path has changed. I think that would be done in htaccess. I've been looking online and I can only find a iframe solution and I don't want that. Thanks for the help Quote Link to comment Share on other sites More sharing options...
haku Posted October 27, 2009 Share Posted October 27, 2009 You can't hide the URL that way. Each URL still has to be unique even if you re-write them, and since you are already on one page and want to go to another one, you will need to also change the URL. A possible way around this is to use AJAX to load the page you want to go to inside the page you are in. As for what you are asking, javascript is the only way you can do it. Quote Link to comment Share on other sites More sharing options...
seanlim Posted October 27, 2009 Share Posted October 27, 2009 I wouldn't say it is the ONLY way to do it, but Javascript is the easiest and fastest option. I have not heard of using .htaccess to hide the URL of the current page. The only way I can think of is by using frames, or as haku suggested, AJAX. However, there is a better solution if you are able to use some server-side scripts: submit the text box in a form to the same page using method="post". Using your server-side script, access the file TEXTBOXINFO and print it out on the same page! There you have it, no visible change in the URL and content from the specified file! Quote Link to comment Share on other sites More sharing options...
haku Posted October 27, 2009 Share Posted October 27, 2009 That's a good point. As for the .htaccess - he was referring to mod rewrite. But it won't work that way. Quote Link to comment Share on other sites More sharing options...
dare87 Posted October 27, 2009 Author Share Posted October 27, 2009 could someone give me an example of what it would be in javascript. I've been looking around and can't find an example. Thanks Quote Link to comment Share on other sites More sharing options...
dare87 Posted October 27, 2009 Author Share Posted October 27, 2009 This is how I did it <form action="" method="get" onsubmit="this.action = '../' + this.elements['code'].value.toLowerCase() + '/'; return true;"> <input type="text" class="required" name="code" id="code" size="15"> <input type="submit" value="Go"> </form> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.