Solved

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

Posted on 2016-10-08
3
48 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 52

Accepted Solution

by:
Julian Hansen earned 500 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
 

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 52

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now