I want to set an initial text in a TEXTAREA based on the value selected
in an earlier SELECT box in the same document.
I tried something like
$init_text=set_ init_text() ;
<TEXTAREA>
<?php echo $init_text ; ?>
</TEXTAREA>
function set_init_text() {
return <script>
document.forms[0].SelectBox.opti ons[document.forms[0].SelectBox.sele ctedIndex].value
</script }
But I get a php syntax error with the <script> tag.
What's the correct way to do it ?
in an earlier SELECT box in the same document.
I tried something like
$init_text=set_ init_text() ;
<TEXTAREA>
<?php echo $init_text ; ?>
</TEXTAREA>
function set_init_text() {
return <script>
document.forms[0].SelectBox.opti ons[document.forms[0].SelectBox.sele ctedIndex].value
</script }
But I get a php syntax error with the <script> tag.
What's the correct way to do it ?
Comment