Solved

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

Posted on 2016-10-08
3
41 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 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
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
Comment Utility
Okay, good explanation. Thanks!

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

Expert Comment

by:Julian Hansen
Comment Utility
You are welcome.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

762 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

10 Experts available now in Live!

Get 1:1 Help Now