karimali831 Posted March 28, 2010 Share Posted March 28, 2010 $result = safe_query("SELECT * FROM ".PREFIX."cup_clan_members WHERE userID = '".$userID."' AND function = 'Leader'"); $clan = '<option value="0" selected="selected"> - '.$_language->module['choose_team'].' - </option>'; while($dm=mysql_fetch_array($result)) { $clan .= '<option value="'.$dm['clanID'].'">'.getclanname($dm['clanID']).'</option>'; $clanID = $dm['clanID']; } <form method="get" action="clans&action=clanregister&cupID='.$dl['ID'].'"><select name="clanID">'.$clan.'</select><input type="submit" value="Go"></form> Output: clans&action=clanregister&cupID=<ID>?clanID=<ID> Needed output: clans&action=clanregister&cupID=<ID>&clanID=<ID> I get correct outputs for both IDs also. I tried: <form method="get" action="clans&action=clanregister&cupID='.$dl['ID'].'&clanID='.$clanID.'"><select>'.$clan.'</select><input type="submit" value="Go"></form> but it doesn't select correct clanID from dropdown. anyone can help please? Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/ Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 It looks like you're trying to put a form value into the ACTION attribute of the <FORM> tag. You don't need to do that. Instead, use HIDDEN fields. Not tested... <input type="hidden" name="action" value="clanregister"> <input type="hidden" name="cupID" value="myValueHere"> Then remove the extra values you have in your ACTION attribute and only have the page name there. Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1032856 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 Thanks but everytime I use <select name="clan"> it will end up like this: index.php?site=clans?clan=325 And I need it like this index.php?site=clans&clan=325 for it to work. and I need the select name for it to select the correct one. Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1032952 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 I've also tried: <form action="index.php?"><select name="site"> <option value="clans&action=clanregister&cupID='.$dl['ID'].'&clanID='.$dm['clanID'].'"> Output: index.php?site=clans%26action%3Dclanregister%26cupID%3D23%26clanID%3D325 :S %26 = "&" %3D = "=" Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1032956 Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 Thanks but everytime I use <select name="clan"> it will end up like this: index.php?site=clans?clan=325 That's because it takes the first name/value pair it finds and attaches a ? to it after the page name. All other name/value pairs after that will have &. The ACTION attribute should only have the page name; remove any ? or & it has. You never have to manually add in ? or &, the form will do it for you. On any form tags, the NAME attribute should have a name only, and the VALUE attribute should have a single value only; no mixing and adding of multiple values with ? and &. Not tested... <form action="index.php"> <select name="site"> <option name="clanID" value="{$dm['clanID']}'"> </select> <input type="hidden" name="cupID" value="{$dl['ID']}"> <select type='hidden' name='action' value='clanregister'> </form> I'm assuming that you don't have multiple values for cupID for each form. Basically, your loop would generate more <option></option>. Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1032988 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 Now I get index.php?site=325&cupID=23 needs to be index.php?site=clans&action=clanregister&cupID=23&clanID=325 There are multiple clanIDs and generates a list of clanIDs. Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1033022 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 Something new.. $teamID = $dm['clanID']; <form action="index.php"><select name="site">'.$clan.'</select> <input type="hidden" name="action" value="clanregister"><input type="hidden" name="cupID" value="'.$dl['ID'].'"> <input type="hidden" name="clanID" value="'.$teamID.'"><input type="submit" value="Go"></form> $clan .= '<option name="clanID" value="clans">'.getclanname($dm['clanID']).'</option>'; Everything is ok except clanID is incorrect because option value is not $dm['clanID'] Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1033028 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 No one? is there something else I can use then? java links for dropdowns.. ? so I can type in my own custom URL without these annoying "?" getting on the way. :( more complicated now than simple. Closest: index.php?site=325&action=clanregister&cupID=24&clanID=325 <CORRECT ID> <option value="'.$dm['clanID'].'">'.getclanname($dm['clanID']).'</option> Or... index.php?site=clans&action=clanregister&cupID=24&clanID=<INCORRECT ID> because option value is not $dm['clanID'] <option value="clans">'.getclanname($dm['clanID']).'</option> understand better? Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1033053 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 does money sound good to anyone? Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1033105 Share on other sites More sharing options...
ignace Posted March 28, 2010 Share Posted March 28, 2010 You where on the right track the correct is: <form action="index.php"> <input type="hidden" name="site" value="clans"> <input type="hidden" name="action" value="clanregister"> <input type="hidden" name="cupID" vlaue="<?php echo $dl['ID']; ?>"> <select name="clanID"> <option><?php print $clan; ?></option> </select> <input type="submit" value="Go"> </form> Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1033143 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 Thanks!! but <?php echo $dl['ID']; ?> in input breaks the page? Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1033165 Share on other sites More sharing options...
karimali831 Posted March 28, 2010 Author Share Posted March 28, 2010 I FIXED IT!!!! I LOVE YOU!! THANK YOOOOS OOOOOOOOOOOOOOOOOOOOO MUCH!! been trying to do it all day, much appreciated :D Link to comment https://forums.phpfreaks.com/topic/196736-simple-form-question/#findComment-1033167 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.