Posted by Steve on 01/09/06 12:23
On Mon, 09 Jan 2006 09:32:42 +0000, Peter Fox wrote:
No interaction, but php can quite happily write js just as easily as it
can write html/xhtml/xml/...
> Following on from 's message. . .
>>I want to set an initial text in a TEXTAREA based on the value selected
>>in an earlier SELECT box in the same document.
> Sorry but you have completely mis-understood how php works.
>
> Client browser - "Web server! send me this resource" Web server - "OK"
> [ FX rummages around while running AND FINISHING a php script] "Here it
> is now - Thank you and have a nice day" Client browser - "User I will
> show you the HTML just sent to me by the server"
>
>
> Javascript = client side
> php = server side. [ie no interaction]
>
>
>
>
>
>>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.options[document.forms[0].SelectBox.selectedInde
>>x].value
>></script }
>>
>>
>>But I get a php syntax error with the <script> tag.
>>
>>What's the correct way to do it ?
>>
[Back to original message]
|