I'm having trouble getting my code to do what I want.
<select name="Item" id="Item" onChange="this.form.Amount.placeholder = <?php
$Selected = "this.form.Item.options[this.form.Item.selectedIndex].value";
if (strpos($Selected, ':') !== FALSE){
$ID = explode(':', $Selected);
$_POST["Durability"] = $ID[1];
echo $ID[0];
}else{
echo $Selected;
}
?>">
<option value="">
Select an Item
</option>
<?php
$file = fopen("Items.txt", "r");
while(!feof($file)){
$line = fgets($file);
echo '<option value='.$line.'>'.$line.'</option>';
}
fclose($file);
?>
</select>
... So what It should do, is when I select a Item from the menu, it changes the Amount form to match the value of the menu.
The items the menu prints out are things like:
2 Grass
3 Dirt
3:1 Dirt (No Grass)
3:2 Podzol
4 Cobblestone
5 Wooden Plank (Oak)
5:1 Wooden Plank (Spruce)
5:2 Wooden Plank (Birch)
5:3 Wooden Plank (Jungle)
5:4 Wooden Plank (Acacia)
5:5 Wooden Plank (Dark Oak)
And as you can see it sets the option value as the line, but when it does the onChange it doesn't even notice the words after the numbers, and It doesn't want to split at ':'
To see what I'm doing, just visit: http://www.sniperzciinema.site50.net/Test/