Doing a 'POST' from a URL?
deicist
Manchester, UK
Okay, simple question and I'm sure it has a simple answer (which I'll probably kick myself for not knowing ). I'm using PHP and I want to submit information to a script using a link instead of a form button. How would I go about this?
for a bit more detail... I have a script which searches my database for information and it works fine from the search form. Now what I want to do is present the user with a table containing various subsets of the information, they click a link associated with a subset and the search criteria is passed to the search script. Should be easy enough but I don't know how to do POST requests in a hyperlink
for a bit more detail... I have a script which searches my database for information and it works fine from the search form. Now what I want to do is present the user with a table containing various subsets of the information, they click a link associated with a subset and the search criteria is passed to the search script. Should be easy enough but I don't know how to do POST requests in a hyperlink
0
Comments
GET requests are via url strings, and should only be used to 'get' data. query strings are GET only. POST data is encoded and written to a port where the webapp reads in and decodes that data, then does something with it.
FWIW:
POST: form data is passed on STDIN, so the script should read from there (the number of bytes to be read is given by the Content-length header).
GET: the data is passed in the environment variable QUERY_STRING.
The content-type (application/x-www-form-urlencoded) is identical for GET and POST requests. URL string lengths are typically restricted to around 1kb in size.
edit:
i've used GET to do delete operations before (which are not idempotent). it's not like the HTTP police are going to come get you.