ID:167048
 
While recently using the POST method in DMCGI, I noticed that accessing the values of a submitted form is as simple as hreflist["name"]. I had always thought (as it says in the reference) that hreflist is simply params2list(href), and href is what comes after the '?'. With POST, there is no '?', so I don't understand how hreflist["whatever"] works exactly. Anyone knowledgeable in the subject care to elaborate?

Thanks!
Airjoe
Airjoe wrote:
While recently using the POST method in DMCGI, I noticed that accessing the values of a submitted form is as simple as hreflist["name"]. I had always thought (as it says in the reference) that hreflist is simply params2list(href), and href is what comes after the '?'. With POST, there is no '?', so I don't understand how hreflist["whatever"] works exactly. Anyone knowledgeable in the subject care to elaborate?

Thanks!
Airjoe

Bump?
In response to Airjoe
Random guessing tells me that it works the exact same way. href_list should seperate the names of the elements and their values with POST the same as with GET.
In response to Jon88
Jon88 wrote:
Random guessing tells me that it works the exact same way.

That doesn't make sense. With POST, there is no '?'. Therefore, href is null. Therefore, hreflist is null. Why is hreflist["whatever"] working?
In response to Airjoe
I think in POST href isn't null, its hidden from the client for passing information like passwords.
In response to Nintendo
Nintendo wrote:
I think in POST href isn't null, its hidden from the client for passing information like passwords.

http://www.byond.com/docs/ref/info.html#/client/proc/Topic

"href: The topic text (everything after the '?' in the full href)."
A subroutine looks if it's a GET or a POST request. If it's get, it sets ? + vars/values to href. If it's POST, it converts the data to "?var=value&var2=value" and sets href to it.

Basically, it removes the need to check if it's GET or POST, although I believe it would be possible to differentiate between the two.
In response to Airjoe
Airjoe wrote:
http://www.byond.com/docs/ref/info.html#/client/proc/Topic

"href: The topic text (everything after the '?' in the full href)."

The reference entry is for client/Topic(), not CGI/Topic(). There's no way to send POST data to a client object, so the above is fully correct.

When DMCGI receives POST data, it reads that data and converts it to the appropriate href/href_list format, just as if it had received the same data in a GET request. As Android Data said, this is a convenience so you don't have to worry about the distinction yourself.
In response to Mike H
Mike H wrote:
Airjoe wrote:
http://www.byond.com/docs/ref/info.html#/client/proc/Topic

"href: The topic text (everything after the '?' in the full href)."

The reference entry is for client/Topic(), not CGI/Topic(). There's no way to send POST data to a client object, so the above is fully correct.

When DMCGI receives POST data, it reads that data and converts it to the appropriate href/href_list format, just as if it had received the same data in a GET request. As Android Data said, this is a convenience so you don't have to worry about the distinction yourself.

Ah! Thank you very much, and Android Data as well. So really, there's no difference between POST and GET other than POST won't show the input names/values in the URL?
In response to Airjoe
So really, there's no difference between POST and GET other than POST won't show the input names/values in the URL?

Only in CGI -- post won't work outside of CGI. And, get has a limitation I believe. It can only accept so many bytes.
In response to PirateHead
PirateHead wrote:
Only in CGI -- post won't work outside of CGI. And, get has a limitation I believe. It can only accept so many bytes.
It's mostly the server (in some cases the client) refusing the long URL to be received/sent.
In response to Airjoe
Well, don't go crazy with post. Although it is good for some things, you want people to be able to easiely reference pages that are generated by DMCGI. The forum numbers, for example. I really hate it when I get to a page, then can't get back to it without going though a million pages. That to me is the big difference between get and post. I perfer get 90% of the time(The other %10 is for things like passwords and whatnot).
In response to Scoobert
Scoobert wrote:
Well, don't go crazy with post. Although it is good for some things, you want people to be able to easiely reference pages that are generated by DMCGI. The forum numbers, for example. I really hate it when I get to a page, then can't get back to it without going though a million pages. That to me is the big difference between get and post. I perfer get 90% of the time(The other %10 is for things like passwords and whatnot).
GET should be used for the little things. With this you can think of the browsing of a forum.
POST should be used for things you don't essentially want someone to see, the more important things. Such as posting a topic, changing your password, etc.
GET remains stored in the browser for future usage, plus anyone can see the values of the variables done via GET, while POST is immidiatly discarded.
In response to Android Data
Dude, it's really hard to know where your post begins when you're quoting people. At least put a space between yours and the quoted post.