dynamic field
Posted: Fri Jun 27, 2008 8:14 am
Hi,
Im creating a php website form that requires some tweaks. Currently, i am working on coding a case where if the 'other' option in a drop down list is selected then a new textbox must appear instanteously on change. I was wondering how I can do this. I initially tried to do it though javascript but am not getting it. Is there a way to do it through php? Can someone please show me how I can do this? Here is my code that i did so far
<div id="organization" style="display:none;">
<p>
Organization <select name="organization" onchange = " if (this.text == 'Other')
{document.getElementById('otherOrgName').style.display = 'block';}
else{ document.getElementById('otherOrgName').style.display = 'none';} " >
<?php
while($row = mysql_fetch_array($org))
{
echo '<option value="org">'.$row['orgName'] . '</option';
}
?>
</select>
</p>
</div>
<div id = "otherOrgName" style="display:none;">
<p>
Organization Name <input type="text" name="otherOrgName">
</p>
</div>
Thanks!
Im creating a php website form that requires some tweaks. Currently, i am working on coding a case where if the 'other' option in a drop down list is selected then a new textbox must appear instanteously on change. I was wondering how I can do this. I initially tried to do it though javascript but am not getting it. Is there a way to do it through php? Can someone please show me how I can do this? Here is my code that i did so far
<div id="organization" style="display:none;">
<p>
Organization <select name="organization" onchange = " if (this.text == 'Other')
{document.getElementById('otherOrgName').style.display = 'block';}
else{ document.getElementById('otherOrgName').style.display = 'none';} " >
<?php
while($row = mysql_fetch_array($org))
{
echo '<option value="org">'.$row['orgName'] . '</option';
}
?>
</select>
</p>
</div>
<div id = "otherOrgName" style="display:none;">
<p>
Organization Name <input type="text" name="otherOrgName">
</p>
</div>
Thanks!