Hi;
I'm a beginner and I'm getting a big headache figuring how to convert php variables into Javascript variables.
I want to use the content of $theName as the value for an input tag. $_SESSION['$Sess_Name'] is loaded with the right data, I verified it. But my function InitField returns always the word NULL.
Why is that? Where is the problem?
Thanks
I'm a beginner and I'm getting a big headache figuring how to convert php variables into Javascript variables.
I want to use the content of $theName as the value for an input tag. $_SESSION['$Sess_Name'] is loaded with the right data, I verified it. But my function InitField returns always the word NULL.
Why is that? Where is the problem?
Thanks
Code:
function InitField() {
<?php
$theName = $_SESSION['$Sess_Name'];
?>
var tempoVar = "<?php echo json_encode($theName); ?>";
var myInput = document.getElementById('theName');
myInput.value = tempoVar;
}
Comment