| Welcome to Webforumz.com. |
|
Apr 10th, 2008, 23:38
|
#1 (permalink)
|
|
Junior Member
Join Date: Aug 2007
Location: London
Posts: 13
|
submit part of a url through a text box
Hi
Can anyone help. I have a website that I want people to use to access their website's statistics by simply entering their domain name into a text box, click submit and be taken to their statistics page.
For example
Someone has the domain name cats.co.uk. So they enter 'cats.co.uk' into the text box, click submit and it loads up http://cats.co.uk/statistics
Every domain name's statistics url is set up the same way. eg http://domainname/statistics
Does anyone know how I could do this? Please dont worry about security issues. Id rather a solution that uses html (and php if need be). Im trying to avoid Javascript (if possible) and setting up a database to store domain names.
I look forward to your answers
Thanks
Mark
|
|
|
Apr 11th, 2008, 00:05
|
#2 (permalink)
|
|
Up'n'Coming Member
Join Date: Mar 2008
Location: Chester, UK
Age: 17
Posts: 87
|
Re: submit part of a url through a text box
Oh nvm, i think i mis-understood.
A quick google returned this to go to a url, just needs a little tinker.
Quote:
<form name="openlocation">
<input type="text" name="href" value="http://">
<input type="button" value="Go To" onClick="location.href=document.openlocation.href. value;; ">
</form>
|
I'm off to bed, if no one else replies i'll show you tomorrow
Last edited by Bocaj; Apr 11th, 2008 at 00:37.
Reason: Mis understood
|
|
|
Apr 11th, 2008, 07:23
|
#3 (permalink)
|
|
Junior Member
Join Date: Aug 2007
Location: London
Posts: 13
|
Re: submit part of a url through a text box
Thanks Bocaj,
Its a start! Further than I got!
|
|
|
Apr 11th, 2008, 15:32
|
#4 (permalink)
|
|
Junior Member
Join Date: Aug 2007
Location: London
Posts: 13
|
Re: submit part of a url through a text box
Has anyone got any ideas???
|
|
|
Apr 11th, 2008, 16:35
|
#5 (permalink)
|
|
Chief Moderator
Join Date: Oct 2007
Location: UK
Posts: 701
|
Re: submit part of a url through a text box
- Code: Select all
<form name="openlocation">
<input type="text" name="href" value="http://">
<input type="button" value="Go To" onClick="location.href=document.openlocation.href.value + /statistics/;">
</form>
__________________
|
|
|
Apr 11th, 2008, 18:15
|
#6 (permalink)
|
|
Junior Member
Join Date: Aug 2007
Location: London
Posts: 13
|
Re: submit part of a url through a text box
Thank you moderator, that is really helping and it works great! In terms of enhancing it:
Is there anyway of having the 'http://' hidden?
And an error message to appear should they enter their domain wrongly?
Thanks
Mark
|
|
|
Apr 11th, 2008, 21:35
|
#7 (permalink)
|
|
Up'n'Coming Member
Join Date: Mar 2008
Location: Chester, UK
Age: 17
Posts: 87
|
Re: submit part of a url through a text box
sorry for not getting back to it sooner... been busy today
- Code: Select all
<form name="openlocation">
<input type="text" name="href">
<input type="button" value="Go To" onClick="location.href=document.openlocation.href.value + /statistics/;">
</form>
However they need to put the http:// so it knows it's an external address otherwise it will try to load it on your site.
E.g.
http://www.yoursite.com/theresite.com/statistics/
So, insert the http:// for them...
- Code: Select all
<form name="openlocation">
<input type="text" name="http" >
<input type="button" value="Go To" onClick="location.href='http://' + document.openlocation.http.value + /statistics/;">
</form>
If they just use www. or no www. it's fine, however if they include the http:// then you'll get issues, so it should be stripped prior to proceeding to the location, unfortunatly my javascript knowlege isn't that good.
But i'll look into it
And as for checking to see if the domain is entered incorrectly, can you elaborate on this a bit?
Because i can already interperate it in a few different ways =/
Last edited by Bocaj; Apr 11th, 2008 at 21:40.
Reason: Removed the uneccisary value=""
|
|
|
Apr 12th, 2008, 08:23
|
#8 (permalink)
|
|
Junior Member
Join Date: Aug 2007
Location: London
Posts: 13
|
Re: submit part of a url through a text box
Hi Bocaj,
Thank you for your hardwork! Your version solved the hiding the http:// part which is great! The error message was for if they accidently entered the wrong domain. But I dont think I can get round this. I will just put a message by the box to let users know to accuately put in their domain name.
Im really pleased with that script now. Does that script use javascript? And if so, and someone has javascript disabled, will the script not work?
Thanks again for your hard work mod and Bocaj.
Mark
|
|
|
Apr 12th, 2008, 08:25
|
#9 (permalink)
|
|
Junior Member
Join Date: Aug 2007
Location: London
Posts: 13
|
Re: submit part of a url through a text box
Oh one other thing :o) You have to physically click on the 'go to' button to go to thye stats page. Is there a way to just press return and it will submit the address?
|
|
|
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|