Jump to content

Archived

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

gfX

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

[code]
<B>Number of Items:</b><BR>
<select name="number">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</select>
[/code]

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:
[code]
for ($i = 0; $i < $_POST[number]; $i++) {
[/code]

works fine. thanks anyway

Share this post


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

Here is the final code:

[code]
$numbervar = "

<table cellspacing=5 cellpadding=5>
<tr>
<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 .= "
<TR>
<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>
</tr>";
}
[/code]

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.