Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-13-2013, 02:54 PM
|
#1
|
|
Member
Registered: Jan 2013
Posts: 39
Rep: 
|
html: submitting form data as GET parameters instead of POST?
Hi. I'm no expert at HTML, but I'm forced to become one because of a django project I have been assigned. I have a page which has a search box, which sends string data to a page over POST. However, it would simplify some other code if the form would send the data as GET parameters. (The search does not change the server/data, so this makes philosophical sense as well.) Is there some setting you change in the form HTML to make it do that, or do you have to use some kind of advanced Javascript? I know some search engine search boxes do this, but I'm not sure exactly how.
|
|
|
|
02-13-2013, 04:14 PM
|
#2
|
|
Member
Registered: Jul 2012
Location: Cologne, Germany
Distribution: Aptosid
Posts: 39
Rep:
|
Hi. Just changeing the value of the method attribute from post to get should do the trick.
Code:
<form action="whatever" method="get">
|
|
|
2 members found this post helpful.
|
02-14-2013, 08:18 AM
|
#3
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,257
|
Quote:
Originally Posted by joe_2000
Hi. Just changeing the value of the method attribute from post to get should do the trick.
Code:
<form action="whatever" method="get">
|
This might work if the accordant code on the server is agile enough to determine what method was used. Don't know about Django, but the code that services the form may be hardwired to use one particular method. If you are replacing that code anyway, it won't really matter. The nature of the form often dictates the most appropriate method to use. Post requests may be more appropriate for larger volumes of data.
--- rod.
|
|
|
|
02-14-2013, 06:03 PM
|
#4
|
|
Senior Member
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 4,548
|
Generally speaking, POST is by-far more flexible in what sort of data it can easily transfer. You probably don't want to change it to use GET. Django is perfectly capable of handling data that arrives in either format .. in fact, it should not care. Figure out what you do not yet understand about Django, and do not (please do not take me wrongly here ...) "screw things up" because you don't yet.
You're barking up the wrong tree .. and about to make a big mistake. Learn more about Django. Don't do anything yet.
|
|
|
|
02-14-2013, 10:39 PM
|
#5
|
|
Senior Member
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 3,650
|
Sundiavlvcs, what does he not understand about Django, and what big mistake is he about to make?
Last edited by dugan; 02-15-2013 at 11:21 AM.
|
|
|
|
02-15-2013, 01:08 PM
|
#6
|
|
Member
Registered: Jan 2013
Posts: 39
Original Poster
Rep: 
|
Quote:
Originally Posted by sundialsvcs
Generally speaking, POST is by-far more flexible in what sort of data it can easily transfer. You probably don't want to change it to use GET. Django is perfectly capable of handling data that arrives in either format .. in fact, it should not care. Figure out what you do not yet understand about Django, and do not (please do not take me wrongly here ...) "screw things up" because you don't yet.
You're barking up the wrong tree .. and about to make a big mistake. Learn more about Django. Don't do anything yet.
|
Situation is basically this: I have a page that provides searches of data through a form, and the same page displays search results. Currently, the form sends search requests information over post. However, some search results, and sometimes even other pages, have hyperlinks which send in additional search information (i.e., new searches) through GET parameters in the hyperlink. So, in the backend, there has to be /both/ code for handling search request information received over POST and search request information received over GET.
So, naturally I wanted to simplify the code, by unifying this to one method or the other. GET makes more sense to me, because 1) I don't know how to have a hyperlink send parameters over POST, and 2) the searches do not change the database, and 3) if search request info is sent over GET, then search results can be "saved" through bookmarks. Now, if somebody has a better argument or a better approach, my ears are open.
|
|
|
|
02-15-2013, 01:13 PM
|
#7
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,257
|
sundialsvcs makes a good point. Please tell us how you expect anything to become simpler by changing the HTTP request method. Your use of the phrase 'which sends string data to a page over POST' makes me wonder how strong your understanding of HTTP is (since it is technically somewhat nonsensical; and I'm not trying to disparage you). It does sound like you may be trying to address a problem, or perceived problem from the wrong angle.
--- rod.
|
|
|
|
02-15-2013, 01:17 PM
|
#8
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,257
|
Quote:
Originally Posted by stateless
in the backend, there has to be /both/ code for handling search request information received over POST and search request information received over GET.
|
Any well crafted website should work this way, IMHO. It is the agility I referred to in a prior post.
--- rod.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:40 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|