Norman Posted February 19, 2007 Share Posted February 19, 2007 Hi. In some sites urls, at the end, I see the "?" symbol. For what it stands for? For example:http://www.mysiteurl.com/?Why and when it appear? Link to comment Share on other sites More sharing options...
Jonas Posted February 19, 2007 Share Posted February 19, 2007 Alone it does nothing, but it can be used for queries in URLs, that is to pass certain variables to the page you're requesting. For example, this thread comes from the same page as all the others, that is index.php, but giving the page a certain value for the variable showtopic makes the index.php page request spesific database info to get this exact page. For more than one query, you use ampersands (&), such as index.php?userID=1&pageID=3 (just an example). Link to comment Share on other sites More sharing options...
Norman Posted February 19, 2007 Author Share Posted February 19, 2007 Ok, thanks for your reply, Jonas. But for example, in Gaia Online, in the forum index (http://www.gaiaonline.com/forum/?), it automatically appear. Why? Link to comment Share on other sites More sharing options...
Anders Moen Posted February 19, 2007 Share Posted February 19, 2007 I can't explain this, but this is like GET method in forms (<form method="get">). Link to comment Share on other sites More sharing options...
Norman Posted February 19, 2007 Author Share Posted February 19, 2007 Mhh, strange. Lol. I don't understand! Link to comment Share on other sites More sharing options...
Skemcin Posted February 19, 2007 Share Posted February 19, 2007 If the "?" appears in the URL with nothing after it, then it simply means that the application is programmed to send something in the URL but no criteria was met to supply it information.For instance, if you submit a form which uses the "get" method, then all the form fields are put in the URL. If you submit the form without selecting anything, then it could be possible to have a "?" with nothing after it.All in all, if you see it like that, then it is poor programming as the developer has not built enough logic to accommodate all situations.The easiest way to understand forms and even URL parameters is to think of them like questions and answers.?page=home&title=WelcomeWhatever is before each "=" sign is the question and what ever appears after is the answer. So here the first question is "what is my page" and your answer is "home" - as in load the homepage. The second question (every new question after the first (?) is separated by the ampersand (&)) is asking "what is the title" and the answer is "Welcome" - as in put the word "Welcome" in the <title> tag and maybe in the <h1> tag.In forms, its the same thing:<input type="text" name="page" value="home"><input type="text" name="title" value="Welcome">Here the "name" attribute acts as the question and the "value" attribute acts as the answer. Typically, the value is entered by the web site visitor. But this produces the same result.Hope that helps. Link to comment Share on other sites More sharing options...
Norman Posted February 19, 2007 Author Share Posted February 19, 2007 Thanks for your great post, Skemcin. Now I think I've understand. Thanks again. Link to comment Share on other sites More sharing options...
Skemcin Posted February 20, 2007 Share Posted February 20, 2007 Thanks for your great post, Skemcin. Now I think I've understand. Thanks again.Glad it helps - let me know if you have any more questions. Link to comment Share on other sites More sharing options...
Xtazy Posted February 20, 2007 Share Posted February 20, 2007 Yep, now i understand that too...i wanted to ask this a long time ago:)thanx for your post Skemcin. Link to comment Share on other sites More sharing options...
Skemcin Posted February 20, 2007 Share Posted February 20, 2007 my pleasure guys.have fun and let me know if you have any more questions. Link to comment Share on other sites More sharing options...
turntabletux Posted February 23, 2007 Share Posted February 23, 2007 Hi. In some sites urls, at the end, I see the "?" symbol. For what it stands for?I've always wondered this myself. Thanks for explaining Skemcin! -ant Link to comment Share on other sites More sharing options...
Skemcin Posted February 23, 2007 Share Posted February 23, 2007 You're welcome. That's why there is no such thing as a dumb question. Glad to see several folks finding the explanation helpful.:)Its odd just how much it makes sense. The "?" basically tells you, "Hey, I have a question(?)!". And if you have more than one question, its like "and (&) I have another, and (&) another, and (&) another.Then, of course, this url string can be triggered by a form using the "get" method or by a hypertext link. What can be fun is toying with the url. Click this link which posts to this topic. Then after the "&hl=" type a word like "thanks" so the url reads "...?showtopic=11217&hl=thanks" and you will see the page is programmed to accept "hl" as a URL parameter which it then uses to highlight words on the page.Anyway, have fun - using URL variables opens a whole world to conditions you can program with asp, php, or coldfusion. Lots of fun. Link to comment Share on other sites More sharing options...
pulpfiction Posted February 23, 2007 Share Posted February 23, 2007 Then, of course, this url string can be triggered by a form using the "get" method or by a hypertext link. What can be fun is toying with the url. Click this link which posts to this topic. Then after the "&hl=" type a word like "thanks" so the url reads "...?showtopic=11217&hl=thanks" and you will see the page is programmed to accept "hl" as a URL parameter which it then uses to highlight words on the pageoh so "hl" stands for "highlight"...... next time if I search for some text in a page in this forum, it will be easier to "find all" search text in the page, better than ctrl+F.... Link to comment Share on other sites More sharing options...
Skemcin Posted February 23, 2007 Share Posted February 23, 2007 ? and & = FUN! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now