nikefido Posted January 9, 2008 Share Posted January 9, 2008 I have so far only seen POST values used with form data / submit buttons - I'm assuming you can't make a regular link (aka anchor tag) send POST data when it is clicked? The only solution I know would be to use JS to "AJAX" it (although you can set the JS function to send the info synchronously so it actually does reload the page!) Quote Link to comment https://forums.phpfreaks.com/topic/85187-quick-question-regarding-the-use-of-post-values-and-links/ Share on other sites More sharing options...
simcoweb Posted January 9, 2008 Share Posted January 9, 2008 Actually, if i'm understanding your question, using 'POST' creates an array of the form data that can be manipulated in the form processing code. If you want to pass parameters via the url then you would use 'GET' to snag the info and use it. Like this: www.yoursite.com/page.php?memberid=333 Then use: $memberid = $_GET['memberid']; To do things like: echo $memberid; of insert into database, extract from database based upon that id, etc. etc. etc. Quote Link to comment https://forums.phpfreaks.com/topic/85187-quick-question-regarding-the-use-of-post-values-and-links/#findComment-434617 Share on other sites More sharing options...
nikefido Posted January 9, 2008 Author Share Posted January 9, 2008 Actually, if i'm understanding your question, using 'POST' creates an array of the form data that can be manipulated in the form processing code. If you want to pass parameters via the url then you would use 'GET' to snag the info and use it. Like this: www.yoursite.com/page.php?memberid=333 Then use: $memberid = $_GET['memberid']; To do things like: echo $memberid; of insert into database, extract from database based upon that id, etc. etc. etc. right, i know all this - i guess i was just wondering if you could use POST with a regular anchor (link) somehow - which I've assumed is "no" - but never hurts to ask, right? Quote Link to comment https://forums.phpfreaks.com/topic/85187-quick-question-regarding-the-use-of-post-values-and-links/#findComment-434651 Share on other sites More sharing options...
simcoweb Posted January 9, 2008 Share Posted January 9, 2008 Well, in a way you can. Not using the typical <a href> tag, though. You would use it in your 'action' tag in the form: action="nameofpage.php?memberid=$_POST['memberid']" which would pass along the data. You can string as many items as you wish on the end of your url. Quote Link to comment https://forums.phpfreaks.com/topic/85187-quick-question-regarding-the-use-of-post-values-and-links/#findComment-434666 Share on other sites More sharing options...
nikefido Posted January 9, 2008 Author Share Posted January 9, 2008 fair enough, thanks, guess i'll call this topic closed. Quote Link to comment https://forums.phpfreaks.com/topic/85187-quick-question-regarding-the-use-of-post-values-and-links/#findComment-434690 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.