use POST in a link?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
donny
Forum Contributor
Posts: 179
Joined: Mon Aug 11, 2014 11:18 am

use POST in a link?

Post by donny »

hello,

is it possible to post information to another page using a link to the page. without making a form

thank you
jdhmtl
Forum Newbie
Posts: 18
Joined: Tue Aug 12, 2014 7:33 am

Re: use POST in a link?

Post by jdhmtl »

Strictly speaking, no. A link is a GET request. Can you pass information from one page to another? Absolutely. You can append a query string to your GET request (eg. site.com/?param=value&param2=value2) or, if you don't want it in the URL, you can set session data on one page and retrieve it on another. Neither really behaves like a form, but they'll both get the job done. Query string is a better choice if you want something you can bookmark and share, sessions are a better option if you're passing data you don't want easily read.
kladrian
Forum Newbie
Posts: 4
Joined: Thu Aug 14, 2014 9:20 am

Re: use POST in a link?

Post by kladrian »

... and beware there are limitations to the length of the URL
take a look at this https://www.google.it/webhp?sourceid=ch ... ET%20limit

bye :)
Post Reply