Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Should I use post or get to go to a specific record in a list of records

Posted on 2016-10-08
3
Medium Priority
?
72 Views
Last Modified: 2016-10-08
I have just set up a contact form that both stores the data in a database as well as emails me data from the submitted form. If I go to my dashboard area I can see a list of messages received. My first thought would be to use a get request to view each one e.g.:

<a href="contact_detail.php?contact_id=<?php echo $contact_id; ?>">

Open in new window


I just noticed though that experts exchange does not have something like this if I check my list of questions and click on one. Instead I see something like:

https://www.experts-exchange.com/questions/123456/name-of-question.html

Does it look like that because they are performing url rewriting to get pretty urls or are they using post instead of get?

And that makes me wonder, should I use post or get for what I am doing? I thought GET was the normal way of doing it.
0
Comment
Question by:Black Sulfur
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 41835077
They are using GET - as those are simple links - POST only works with a form or AJAX request - you can't post with <a>

In EE's case they are either using URL rewriting or slugs that in the database map to the question.

In terms of pretty url's these make sense on public sites where you want Search engines to see your pages and people to remember URL's (not that anyone does that). On a site that has a dashboard - implies a login which makes URL rewriting unnecessary. You can still do it - but in my view - a whole bunch of effort for no payoff.

I would go with a plain old URL with parameters.

If down the line you decide you want to use a different format say
contact/1/25
You an still do this with URL rewriting without having to change your internal structure.
0
 
LVL 1

Author Comment

by:Black Sulfur
ID: 41835079
Okay, good explanation. Thanks!

I want to ask a related question to this so will open up a new question.
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41835115
You are welcome.
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question