Solved

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

Posted on 2016-10-08
3
62 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 57

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
 
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 57

Expert Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
embadded search engine in website 4 47
SSL unsecure page mystery 17 47
PHP MYSQLI Connection in Function in a class 4 29
Sending JSON Via POST In PHP 7 28
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 i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 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