I want to assign the php variable $stop
to the javascript variable stopped
<?php
$stop = $_POST['stop'];
?>
<script>
var stopped = "<?php echo($stop) ?>";
alert(stopped); //Output: alertbox with the text: <?php echo($stop) ?>
</script>
How can I solve this?
Since the PHP source code is being alerted, the document is not being run through the PHP preprocessor before being delivered to the browser.
Make sure that:
.php
extension, but it is configurable).