tobywimberley Posted July 13, 2011 Share Posted July 13, 2011 Hi all, I am pretty new to php and am sure this is a simple task if you know what to google, however I do not. My issue is that I have a page index.php which is a simple div layout with all of the content placed by using "include ("pagename.php")" . I have a page that simply has a $var=$_GET form on it that works great on its own. My menu calls the content by setting the $page variable to href's such as "index.php?page=home" . the links all work great until i submit the form where it changes the addy in the bar from lgmanagement/index.php?page=groupinfo& to lgmanagement/index.php?group=Deliberately+Different&select=Select . If I go and alter the addy to lgmanagement/index.php?page=groupinfo&group=Deliberately+Different&select=Select it works great. Iv'e tried to change the form action to compensate but just cant quite figure it out... I know it is possible to "stack actions" (if that is the right terminology) I just don't know how! Thank for helping us noobs! Toby Quote Link to comment https://forums.phpfreaks.com/topic/241863-problems-with-form-action-in-an-included-page/ Share on other sites More sharing options...
teynon Posted July 13, 2011 Share Posted July 13, 2011 Can you post your form code. I'm not quite sure what you're asking here. It looks like maybe your form is posting its data with method="GET"??? If so, that would probably override the page variable in the url. But like I said, your post is confusing so I don't know for sure what the issue is. Quote Link to comment https://forums.phpfreaks.com/topic/241863-problems-with-form-action-in-an-included-page/#findComment-1242087 Share on other sites More sharing options...
tobywimberley Posted July 13, 2011 Author Share Posted July 13, 2011 Sorry for being unclear.. I'm only a 2 week old php user so i'm not sure how detailed to be... Form Code: // Query the database to gather Group info $sqlgroups="SELECT id, name FROM lifegroups ORDER BY name;"; $resultgroups=mysql_query($sqlgroups) or die(mysql_error()); // The form <form action="<?php echo $_SERVER['PHP_SELF']; ?>?page=groupinfo&" method="get" name="GatherInfo"> <select name="group" id="group"> <option value="">Select a LIFE Group</option> <?php $i=0; while ($i<mysql_num_rows($resultgroups)) { ?><option value="<?php echo stripslashes(mysql_result($resultgroups,$i,name)); ?>"><?php echo stripslashes(mysql_result($resultgroups,$i,name)); ?></option><?php $i++; } ?> </select> <input type="submit" name="select" id="select" value="Select" /> </form> I hope this is what you needed, I could also send the index and menu if needed.... Thanks Quote Link to comment https://forums.phpfreaks.com/topic/241863-problems-with-form-action-in-an-included-page/#findComment-1242090 Share on other sites More sharing options...
tobywimberley Posted July 13, 2011 Author Share Posted July 13, 2011 As you suggested I changed the GET to POST and it works like a champ!! Thanks man! You Rock!!! Quote Link to comment https://forums.phpfreaks.com/topic/241863-problems-with-form-action-in-an-included-page/#findComment-1242092 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.