Eruondo Posted January 22, 2009 Share Posted January 22, 2009 I'm trying to make a dropdownbox which would list all items of a special itemtype. Once you have selected the desired item, you would be redicrected to another site. How would I go about doing this? I've tried myself, but I just started learning a couple of days ago, and I need this for a mod I am making for my game. Thank you! Eruondo. Quote Link to comment Share on other sites More sharing options...
Floydian Posted January 22, 2009 Share Posted January 22, 2009 Re: Dropdown box. that sounds like a HTML Select Element. <form method="post" action="TheSiteYouWantToSendThemTo"> <select name="someName"> <option value="itemId">Some Item Name</option> <option value="itemId">Some Item Name</option> <option value="itemId">Some Item Name</option> <option value="itemId">Some Item Name</option> </select> <input type="submit" value="Submit"> </form> Quote Link to comment Share on other sites More sharing options...
Eruondo Posted January 22, 2009 Author Share Posted January 22, 2009 Re: Dropdown box. I probably explained it wrong, :-) I use MCCodes V2. When I add an item in the game, you got to select a itemtype. Now, I want a dropdownbox that would list all these items of a special itemtype automcatically as I add them. Does it make any sence? Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted January 22, 2009 Share Posted January 22, 2009 Re: Dropdown box. lol not explained good for me, lol I don't understand what you want...Floydian gave you a dropdown option code........ If your pulling it from a table in the database........and you made something different...Wouldn't easiest way for you to learn is Look at the code for the one you just named...Then copy it and make it work for the table that your workin with.? And don't worrry....I suck at explaining to, lol Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 22, 2009 Share Posted January 22, 2009 Re: Dropdown box. Try something like this on the select code floydian posted (this is a general guide not the actual code before you reply with an error) <select name="someName" onChange="window.location='pageurl.php?itmtype='+this.value;"> Quote Link to comment Share on other sites More sharing options...
Floydian Posted January 22, 2009 Share Posted January 22, 2009 Re: Dropdown box. I think I got ya. When you get your list of items, something like select * from items add in something like select * from items where itm_type = xxx You will need to know the id number for the specific item type you want though. your items will each contain the number for the item type they are associated with or you can look in the item types table and pull the id for the item type there. Quote Link to comment Share on other sites More sharing options...
Eruondo Posted January 23, 2009 Author Share Posted January 23, 2009 Re: Dropdown box. I tried that and got something halfway working. Thanks, :D Quote Link to comment Share on other sites More sharing options...
Floydian Posted January 24, 2009 Share Posted January 24, 2009 Re: Dropdown box. Cool, good luck with it. Let us know how it goes ;) Quote Link to comment Share on other sites More sharing options...
Arson Posted March 2, 2009 Share Posted March 2, 2009 Re: Dropdown box. <select name="item"> <? $itmtype=##; $get_items=mysql_query("SELECT * FROM items WHERE itmtype=$itmtype",$c); //MCCodes v1: use this query $get_items=$db->query("SELECT * FROM items WHERE itmtype=$itmtype",$c); //MCCodes v2: use this query while($it=mysql_fetch_array($get_items)) { print"<option value=\"{$it['itmid']}\">{$it['itmname']}</option>"; } ?> </select> Quote Link to comment 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.