| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jul 2006
Posts: 5
|
text box to url
Ok this may be a basic thing i am not familiar with, but i cant figure it out. I am looking for a way to have a text box where users can input data that will be added to the end of a url. So if they input say chris, then it would go to www.mydomain.com/chris. I dont want them to have to enter the whole url, just the last part. If anybody has any ideas, or knows how to do this I would greatly aprechiate it. Thanx in advance, Colin |
|
|
|
|
|
#2 (permalink) |
|
Everything is fine.
|
This is easily accomplished. You have two options of going about; Client Side or Server Side. You would need a simple HTML form that contains a text box for the user to enter their data for which will get appended to your specified URL and of course, you would need a submit button. If you want a client side solution then you'll be looking at JavaScript. Basically using JavaScript you can redirect the user/browser to the pre-defined URL of your choice, including their appended data, straight from the page. However, if the visitor has JavaScript disabled the function will fail to work. If you want a server side solution then you can use pretty much any language, but I would recommend using PHP. When the user submits the form, the data would then get sent to the PHP code (on the server) and it would append the data to your pre-defined URL and then the re-direct would take place. Both methods, as you can see, will have the same effect/outcome. The PHP will work even if JavaScript is disabled and can prevent the user for altering the URL you define, therefore it is safer. If this is a mission critical function, then I'd suggest going with PHP for its robustness and added layer of security. With PHP you could also log which URLs are visited etc etc. Hope that helps a little. - Mike |
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Jul 2006
Posts: 5
|
Thanx, ya i knew u could do it in java. The problem is i dont know php and although i kno u can do it in java and it is a simple script i dont really know java all that well. I have written aplications in java before, but never anything web based. If somebody could write this code in either language for me i would greatly aprechiate it. If anybody does this for me just let me know if there is anything i can ever do for u . |
|
|
|
#4 (permalink) |
|
Everything is fine.
|
First things first; JavaScript is NOT Java. They are two completely seperate languages. If you have written something in Java then writing something in JavaScript is different. To be honest, I don't think people on here will do the work for you just because you've asked. Someone probably will if you offer to send a £ or two their way as most people here are web developers/designers by profession and are unable to spend their time doing "freebies". You might get lucky though if someone is willing to do it in their spare time, but don't rely on it happening. The sort of JavaScript is commonly found on many JavaScript sites , such as javascript.internet.com. If all else fails, try a search in Google. - Mike |
|
|
|
#6 (permalink) | |
|
ExCoder
|
Quote:
Well, sometimes if you had a luck and there's a nice and cute pplz around you, you can get something for free And because i'm mainly a programmer and less a designer so i'll help you. HTML Code:
This is simple and easy to use script. Save it as redirect.html and upload it to your server, then just type in the box (input field) something (let's say you have subdirectory on your host named test with file called index.html in, then just type test in the fields and press Go! button... If you have any questions, feel free to ask I hope this will help you. |
|
|
|
|
#7 (permalink) |
|
Registered User
Join Date: Jul 2006
Posts: 5
|
Wow thank you soooo much. I had to slightly moddify it, but it was almost exactly what I wanted. Thanx again. I dont know anything about javascript so i couldnt write this myself. I dont know what else to say besides thanx a ton. |
|
|
|
#8 (permalink) | |
|
ExCoder
|
Quote:
You are welcome |
|
|
![]() |