MmmVomit Posted October 1, 2007 Share Posted October 1, 2007 This is more of an HTML question. I know how to send GET and POST data using a form. I can also send GET data by simply appending it to the URL of a hyperlink, like so: <a href="somepage.php?pageid=12345">link</a> Is there some way to send POST data using a hyperlink? Quote Link to comment https://forums.phpfreaks.com/topic/71426-solved-sending-post-data-using-a-hyperlink/ Share on other sites More sharing options...
sljaxon Posted October 1, 2007 Share Posted October 1, 2007 Yes and No. You cannot have an standard link tag (<a href=...) that would include POST data with a basic tag. You could have something like this: <form action="postdata.php" method="post"> <input type="hidden" name="pdata" value="this is my POST data"> <input type="submit" value="My POST page"> </form> That works, but it isn't a link. However, this example does the same thing, but uses javascript to use a link. <html> <head> <script language=javascript> function submitPostLink() { document.postlink.submit(); } </script> </head> <body> <form action="postdata.php" name=postlink method="post"> <input type="hidden" name="pdata" value="this is my POST data"> </form> <a href=# onclick="submitPostLink()">My POST page</a> </body> </html> Should work. EDIT: HTML Syntax Quote Link to comment https://forums.phpfreaks.com/topic/71426-solved-sending-post-data-using-a-hyperlink/#findComment-359539 Share on other sites More sharing options...
MmmVomit Posted October 1, 2007 Author Share Posted October 1, 2007 That's great. About what I expected, but I just didn't know how to do it. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/71426-solved-sending-post-data-using-a-hyperlink/#findComment-359555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.