Hello,
I have this code:
<script>
function checkForOther(obj)
{
if (!document.layers)
{
var txt = document.getElementById("otherTitle");
if (obj.value == "new")
{
txt.style.display = "inline";
// gives the text field the name of the drop-down, for easy processing
txt.name = "selTitle";
obj.name = "";
}
else
{
txt.style.display = "none";
txt.name = "";
obj.name = "selTitle";
}
}
}
</script>
it’s should hide/show input field accourding the user choice - if he choose “<option value=‘new’>new</option>”, the follow action should happend:
<li id='otherTitle'>
<label for='new'>new artist</label>
<input type='text' name='new_artist_name' />
</li>
The script works, but when I click “submit” the parameter that the “select box” should send don’t get send…
here is the full code:
<li>
<label for='artist'>Artists</label>
<select name='artist_id' onchange=\\"checkForOther(this)\\">
<option value='new'>new artist</option>";
$query = mysql_query("SELECT id, name FROM `chords_artists` ORDER BY `name` ");
while($index = mysql_fetch_array($query))
{
$artist_id = $index['id'];
$artist = $index['name'];
echo "<option value='$artist_id'>$artist</option>";
}
echo "
</select>
</li>
<li id='otherTitle'>
<label for='new'>new artist:</label>
<input type='text' name='new_artist_name' />
</li>
Can you please help me with it?