<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PHP With JavasCript</title> </head> <body> <?php $a = 15; if($a > 10){ echo "<script type="text/javascript"> document.write("OK!"); </script>"; } ?> </body> </html> Parse error: syntax error, unexpected 'text' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\HND_WEB\PHP\PHP_with_JavaScript.php on line 13
<?php $a = 15; if($a > 10){ echo "<script type=\"text/javascript\"> document.write(\"OK!\"); </script>"; } ?>
<?php $a = 15; if($a > 10){ echo <<<JAVASCRIPT <script type="text/javascript"> document.write("OK!"); </script> JAVASCRIPT; } ?></javascript>
echo '<script type="text/javascript"> document.write("OK!"); </script>'; ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)