Jump to content

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.
Link to comment
https://forums.phpfreaks.com/topic/3482-select-code/
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.
Link to comment
https://forums.phpfreaks.com/topic/3482-select-code/#findComment-11964
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.