BenHD Posted September 20, 2008 Share Posted September 20, 2008 Hi, I have a page layout where I navigate with /index.php?section=<bla> Now I wanna add a form that calls a site with GET parameters but it always redirects me to index.php with the parameters and forgets the "?section=" stuff. I added a little testpage: echo "<form action=\"index.php?section=test\" method=\"get\"><input type=\"text\" name=\"test\" /><input type=\"submit\" /></form>"; to be sure that I didn't messup in the page itself but I still have the same problem. Could somebody please help me and explain where I messed up? I didn't find anything on the net because I don't know what to search for and I couldn't remember one site that also navigates in the way I do. Thanks Ben Quote Link to comment https://forums.phpfreaks.com/topic/125084-solved-form-action-problem/ Share on other sites More sharing options...
.josh Posted September 20, 2008 Share Posted September 20, 2008 not really sure what you're trying to accomplish here, but if you are trying to make a form that submits with the GET method and you have other vars you want to pass via the GET method as well...just pass those other vars with a hidden input field. Quote Link to comment https://forums.phpfreaks.com/topic/125084-solved-form-action-problem/#findComment-646453 Share on other sites More sharing options...
adam291086 Posted September 20, 2008 Share Posted September 20, 2008 try this echo "<form action=\"/index.php?section=test\" method=\"get\"><input type=\"text\" name=\"test\" /><input type=\"submit\" /></form>"; Quote Link to comment https://forums.phpfreaks.com/topic/125084-solved-form-action-problem/#findComment-646454 Share on other sites More sharing options...
BenHD Posted September 20, 2008 Author Share Posted September 20, 2008 @adam291086 : Thanks but I still have the same result. Anything else I can try? @Crayon Violent; Sorry I didn't make myself clearer. My Problem is that I have a site (index.php?section=test) that should have a form to input some data via a get parameter. When I hit the submit button the data gets transfered to index.php and to to index.php?section=test. Ben Quote Link to comment https://forums.phpfreaks.com/topic/125084-solved-form-action-problem/#findComment-646461 Share on other sites More sharing options...
corbin Posted September 20, 2008 Share Posted September 20, 2008 <input type="hidden" name="section" value="test" /> not really sure what you're trying to accomplish here, but if you are trying to make a form that submits with the GET method and you have other vars you want to pass via the GET method as well...just pass those other vars with a hidden input field. Crayon answered your question a long time ago. Quote Link to comment https://forums.phpfreaks.com/topic/125084-solved-form-action-problem/#findComment-646474 Share on other sites More sharing options...
BenHD Posted September 20, 2008 Author Share Posted September 20, 2008 Thank you guys so much ....... corbin is right Crayon really did answer the question 40 minutes ago. For the books and ppl like me: echo "<form action=\"index.php?section=test\" method=\"get\"><input type=\"text\" name=\"test\" /><input type=\"submit\" /><input type=\"hidden\" name=\"section\" value=\"test\"></form>"; Quote Link to comment https://forums.phpfreaks.com/topic/125084-solved-form-action-problem/#findComment-646479 Share on other sites More sharing options...
.josh Posted September 20, 2008 Share Posted September 20, 2008 fyi you don't need to add section=test in your action='...' Quote Link to comment https://forums.phpfreaks.com/topic/125084-solved-form-action-problem/#findComment-646537 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.