Can JS be used to display a new dropdown already filled by php mysql?
I know that PHP is server-side and JS is client side, I've done some
research but haven't exactly found what I was looking for.
So what I'd like to know is if it is possible to use Javascript to display
PHP code?
Scenario:
I have a drop down list already on the page being updated from a database
(quick example) php while($row...){ option php echo $row["number"]; /option }
and I am using Javacript to display a new drop down list when a button is
clicked
<script language="javascript">
var i = 1;
function changeIt()
{
my_div.innerHTML = my_div.innerHTML +"<br><select><option name='mytext'+
i></option></select>"
i++;
}
</script>
This works but what I'd like to be able to do is have this new drop down
list appear pre filled.
Is this possible to have these 2 items work together?? If so how? Or would
this require a page reload each time since php loads before it reaches the
user (and how again..)?
Any help or guidance would be greatly appreciated.
No comments:
Post a Comment