voyageurdumonde Posted April 17, 2011 Share Posted April 17, 2011 Hello, I like to send and reading variable with post and get. Is it possible? I have do that but that doesn't work <form id="test" action="test.php" method="post"> <input type="hidden" name="a_recup" value="variable_ici"/> </form> <a href='test.php?town=Montreal' onclick='document.getElementById("test").submit()'>link</a> <a href='test.php?town=New_York' onclick='document.getElementById("test").submit()'>Link1</a> <?php $variable=$_POST['a_recup']; echo $variable; $ville=$_GET['town']; echo $town; ?> Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/233996-post-and-get-in-the-same-submission/ Share on other sites More sharing options...
requinix Posted April 17, 2011 Share Posted April 17, 2011 Any reason it has to be GET? Why can't you just put those into the form as normal form controls, like a radio button or even submit button? Quote Link to comment https://forums.phpfreaks.com/topic/233996-post-and-get-in-the-same-submission/#findComment-1202745 Share on other sites More sharing options...
voyageurdumonde Posted April 18, 2011 Author Share Posted April 18, 2011 My links are generated with a SELECT So I don't know how many town or link and I only want have one town not all. How to do that? Quote Link to comment https://forums.phpfreaks.com/topic/233996-post-and-get-in-the-same-submission/#findComment-1202763 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.