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 7986349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:49:55+00:00 2026-06-04T11:49:55+00:00

I have a webapp where I have code like: func handler (w res, r

  • 0

I have a webapp where I have code like:

func handler (w res, r req) {
  if req.Method == POST {
    // create html form 2 with a submit button2
    return ;
  }
  // create html form 1 with a submit button1
  return
} 

func main() {
  handle("/", handler)
}

Now, the root / is registered with the handler func. In the first request (GET), I create a form and send it to the user. If the user submits this form, I handle it under the “POST” method. Now, I create a different form in the post method handler, and now I want a way to do some operations based on what the user typed in this form2, when [s]he submits form2.

What is the standard way with go to handle the form2 form submission ? I have done some asp programming earlier and we use form action to submit to a different asp file. How can I do some actions based on parsing the form2 submission request ?

  • 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-06-04T11:49:57+00:00Added an answer on June 4, 2026 at 11:49 am

    If I’m understanding you correctly, you want a way of routing the same URL to different handlers based on the request method rather than just the path? If that’s the case…

    For comparison, using Python + Django, the way you’re doing this is pretty standard:

    def my_django_view(request):
        if request.method == "POST":
            try_to_process_posted_data()
        elif request.method == "GET":
            show_a_form_to_user()
    

    If you are trying to do fancier things like URL routing based on path and request method (GET, POST, DELETE, …), then you might be interested in something like Gorilla.mux

    It provides some friendly URL routing methods:

    func main() {
        router := mux.NewRouter()
        router.HandleFunc("/", YourGETHandlerFunc).Methods("GET")
        router.HandleFunc("/", YourPOSTHandlerFunc).Methods("POST")
        http.Handle("/", router)
    }
    

    If you’re looking for more resources for web development…

    • Mango: http://paulbellamy.com/2011/05/introducing-mango/
    • Web.go: http://www.getwebgo.com/tutorial
    • Twister: https://github.com/garyburd/twister/blob/master/examples/hello/main.go
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to create a webapp in my server: import web urls
I have to add Wufoo-like WYSIWYG form-builder functionality to a Rails webapp. Does anyone
I have a few HTML files that I'd like to include via tags in
So, I've got a webapp that lets users submit code. The submissions are stored
in my webapp I have a variable like this var data = { getItem:
I'm developing a webapp with Hibernate+Spring 3 (Spring MVC, JSP): I'd like to create
I have a user input form here: http://www.7bks.com/create (Google login required) When you first
I have a server side code to process uploaded binary files: class UploadHandler(webapp.RequestHandler): def
I have a WebApp with two dependencies as shown below. I would like to
I have some test code (as a part of a webapp) that uses urllib2

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.