sheldonlg wrote:
padew wrote:
><?php $var01='test1'; $var02='test2';
?>
<script type="text/javascript">
-1
var a= '<?php echo $var01 ?>';
var b= '<?php echo $var02 ?>';
... many other variables alert(a + ' ' + b + ...);
-2
</script>
in a .php file is possible with ob_start take point 1 to point 2 but to
have an output buffer only for the alert, not also var a, var b ....
ob_start, etc. buffer output. I don't see any output in what you wrote.
Where are the print or echo statements to throw things into the output
buffer?
Note the close '?>' tag, so actually the whole script tag is output.
I'm not sure what the OP is trying to do but I believe they are confused
about the server-side and client-side nature of PHP and Javascript.
PHP outputs the HTML (including Javascript) to the browser where the
Javascript is 'run'. So even with buffering you've still got to output
something at the end to go to the browser.
Robin