Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 617021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:23:22+00:00 2026-05-13T18:23:22+00:00

Let’s say you’re making a blog application, and you’re trying to decide how to

  • 0

Let’s say you’re making a blog application, and you’re trying to decide how to build the comment form for a particular post. Would you

  1. put the blog_post_id as a hidden form field in the comment form, or would you
  2. set the form action to post_comment?blog_post_id=<id> and then grab it from the GET variable instead?

Why?


My 2 cents:

If you put it into POST, then all your variables are in a consistent location when you’re trying to process the form. However, I find that often the blog_post_id will be in the URL anyway, so you’re sending a tiny bit of extra unneeded data (and have to go through the work of printing the hidden field).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:23:22+00:00Added an answer on May 13, 2026 at 6:23 pm

    Technically there really isn’t a whole lot of difference between the two options. Personally, I’d go with the hidden POST because the URL looks cleaner and you won’t have to worry about URL escaping the value*.

    * That should be a non-issue for a numeric id, but oh well…


    Re Edit:

    However, I find that often the blog_post_id will be in the URL anyway…

    This is totally up to you. If you want it there, you can put it there, but you don’t need to.

    …and have to go through the work of printing the hidden field.

    Again, there really isn’t a whole lot of difference…

    <form action="/post_comment?post_id=<?php echo $id; ?>">
    

    vs.

    <form action="/post_comment">
    <input type="hidden" name="post_id" value="<?php echo $id; ?>" />
    

    The hidden input provides a better separation of concerns (on a micro-scale) and is IMHO slightly more readable, while the GET variable is one line less code… Take your pick. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
Let's say you're trying to set a label's text. By doing it, you call
Let's say I have a posts table that has many comments (and a comment
Let me frame it this way.. Say I have an application server running on
Let's say, I have an application that access(read/write) the file system(files inside application), Active
Let's say that I have a html form (actually I have an editor -
Let's say I have a simple form in the administration of my Rails 2.x
Let's say I have 2 windows in my application, and two classes responsible for
Let's say I'm writing a Windows Forms (.NET Framework 3.5) application which shows the
Let's say I have two assemblies: BusinessLogic and Web. BusinessLogic has an application setting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.