PHP and Javascript: Getting file contents with Javascript variable
- by celliott1997
Could someone help me to understand why this isn't working?
var uname = "<?php echo strtolower($_GET['un']) ?>";
var source = "<?php echo file_get_contents('accounts/"+uname+"') ?>";
console.log(source);
I've been trying for a while to get this working and it just doesn't seem to. Before I added in the source variable, it was working fine and displayed the un variable on the page.
Thanks.