Jump to content

[SOLVED] PHP inside of Javascript Problem


zechdc

Recommended Posts

Here is my code and for some reason it will not forward to the page i want it to. $site is getting set ive tested it but what is the problem then? Can I not insert php into javascript?

 

<?php
$site = "neon_score3.php";
?>
<script type="text/javascript">document.location.href='<?php $site;?>'</script> 

Link to comment
https://forums.phpfreaks.com/topic/79623-solved-php-inside-of-javascript-problem/
Share on other sites

Here is my code and for some reason it will not forward to the page i want it to. $site is getting set ive tested it but what is the problem then? Can I not insert php into javascript?

 

<?php
$site = "neon_score3.php";
?>
<script type="text/javascript">document.location.href='<?php $site;?>'</script> 

 

Change

<script type="text/javascript">document.location.href='<?php $site;?>'</script>

 

to

<script type="text/javascript">document.location.href='<?php echo $site;?>'</script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.