Jump to content
MakeWebGames

Dropdown box.


Eruondo

Recommended Posts

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...