Hi this is simple example , you can improve it later :)
<?php
function dropDown()
{
$phpself = $_SERVER['PHP_SELF'];
echo"<form method='post' action='$phpself'>";
echo"<select name='categories'>";
echo"<option value='computer'>computer</option>";
echo"<option value='mechanical'>mechanical</option>";
echo"<option value='electronics'>electronics</option>";
echo"<option value='other'>other</option>";
echo"</select>";
echo"<input type='submit' name='submit' value='Submit Form'><br>";
echo"</form>";
}
?>
<?php
if(isset($_POST['submit']))
{
$name = $_POST['categories'];
if($name == "other"){
echo "<form >";
echo "<textarea name='myTextBox' cols='20' rows='1'>";
echo "Enter some text...";
echo "</textarea>";
echo "<br />";
echo "<input type='submit' ><br>";
echo "</form>";
}
else{
dropDown();
return;
}
}
?>
<?php
dropDown();
?>
Hope it will help you :)