Jump to content


This topic is now archived and is closed to further replies.


SELECT code.

Recommended Posts

Hi, I'm making a "Skill Creator" for my Text-Based game .. and I was wondering if this is possible:

I want a drop down list for the number of Items I would want to put .. So it would be like

<B>Number of Items:</b><BR>
<select name="number">

And so on .. And when I select one of those options, I want it to automatically underneath add input boxes of how many numbers I chose. Sorry if that doesnt make sense.

So if I select 6 from the drop down list then it would create 6 input boxes right below it..

Thanks if anyone couold help me.. or if there is a better way to do this.

Share this post

Link to post
Share on other sites
Meh, I got it to work.

I used an input box for the number and then used:
for ($i = 0; $i < $_POST[number]; $i++) {

works fine. thanks anyway

Share this post

Link to post
Share on other sites
Okay, I have another issue :

Here is the final code:

$numbervar = "

<table cellspacing=5 cellpadding=5>
<th><font face=\"verdana\" size=\"1\">Item Name</th><th><font face=\"verdana\" size=\"1\">Experience</th><th><font face=\"verdana\" size=\"1\">Clan Exp</th><th><font face=\"verdana\" size=\"1\">Level to Make</th></tr>";

for ($i = 0; $i < $_POST[number]; $i++) {
$numbervar .= "
<td align=center><input type=\"text\" name=\"item_name[]\" size=\"30\"></TD>
<td align=center><input type=\"text\" name=\"item_exp[]\" size=\"5\"></TD>
<td align=center><input type=\"text\" name=\"item_cexp[]\" size=\"5\"></TD>
<td align=center><input type=\"text\" name=\"item_level[]\" size=\"5\"></TD>

Okay so if I enter 5 and then it comes up with 5 Input Boxes, What are the values gonna be? (name)
Cause I need the value of each Item name and item exp, etc.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.