This appears to be a scope problem, but I don't understand how this could happen.
The following is the first few lines of one of my functions. I put the JavaScript block in when I noticed that some variables I was expecting weren't set. The alert box, which should show "Product Review" is empty when the page loads. Can anyone see why this is happening?
I have a feeling that I'm just cross-eyed from staring at code for too long and I'll see an obvious mistake I'm making if I look at it again later.
Thank you.
--
-- Ghodmode
Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.
The following is the first few lines of one of my functions. I put the JavaScript block in when I noticed that some variables I was expecting weren't set. The alert box, which should show "Product Review" is empty when the page loads. Can anyone see why this is happening?
Code:
function showPage( $review ) { ?>
<?php
$pageTitle = "Product Review";
include( '../includes/setup.php' );
include( 'header.php' );
?>
<script type="text/javascript">
alert( "<?= $pageTitle ?>" );
</script>
I have a feeling that I'm just cross-eyed from staring at code for too long and I'll see an obvious mistake I'm making if I look at it again later.
Thank you.
--
-- Ghodmode
Give a man a fish and he'll come back to buy more... Teach a man to fish and you're out of business.