is it possible to use something like this and have it output as Hello Jamie?:
code:
<html>
<body>
<?php
<script type="text/javascript">
document.write("hello");
</script
echo 'jamie';
?>
</body>
</html>
is it possible to use something like this and have it output as Hello Jamie?:
code:
<html>
<body>
<?php
<script type="text/javascript">
document.write("hello");
</script
echo 'jamie';
?>
</body>
</html>
No... you can't use Javascript within PHP, but you can do something like:
<html>
<body>
<script type="text/javascript">
document.write("hello<?php
echo ' jamie';
?>");
</script>
</body>
</html>
(By the way, you were missing a '>' on your closing SCRIPT tag.)
ah...yeah i just copied and pasted so it was in the script already and i should just use what you put instead of mine right?
or u could do this
put it in heredoc
<?php
$javascript = <<<JSP
<script type="text/javascript">
document.write("hello Jamie");
</script>
JSP;
echo $javascript;
?>
ok thanks for all your help i think i got it now