Jump to content

Newb question on URLs


KevinM1

Recommended Posts

I wasn't exactly sure where to ask this.  I was thinking about putting it in the design section of the forum, but this seems too general for that.  In any event, here's my question:

I've seen a lot of URLs, especially in message boards, that have a structure like: www.somesite.com/forum/viewthread.php?forum_id=1&thread_id=1#post_1234.  Even the address of the page I'm at right now ends in ?action=post;board=14.0.  Something like that is basically a $_GET[] way of producing the correct page, right?  Is there any particular reason as to why this action method is the method of choice for things like message boards?
Link to comment
https://forums.phpfreaks.com/topic/25304-newb-question-on-urls/
Share on other sites

what gmwebs said to an extent is valid. generally though, URL parameters are used to cause a single page to perform multiple tasks - be it different views, features, pages, etc - i.e, a dynamic page.
other forms of user input - post ($_POST) for example - arent really suited to this sort of thing, mainly because they require an action from the user (POSTing a form, in this case). URL's like this one can be performed without this type of action.  $_GET = what to get from the server, $_POST = what to post to the server.

without $_GET, you'd have an index page, a category page, a forum page, a topic page, plus all the additionals that go with it. i like to personally use $_GET to group together pages with a similar function all into one tidy 'package'. there are other benefits too (development, especially) but these are generally the main ones.
Link to comment
https://forums.phpfreaks.com/topic/25304-newb-question-on-urls/#findComment-115413
Share on other sites

pretty much got it in one. forming these URL's isnt restricted to just being formed by the DB, but is definitely the common way. in the case of message boards/forums, etc, this is the case, and normally the id (eg, forum_id, thread_id, etc) relates directly to the primary key of a database record (because it's unique).
Link to comment
https://forums.phpfreaks.com/topic/25304-newb-question-on-urls/#findComment-115436
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.