Jump to content
Norman

"?" in Urls

Recommended Posts

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).

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

my pleasure guys.have fun and let me know if you have any more questions.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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.:)

Share this post


Link to post
Share on other sites
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
oh 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.... :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...