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? Thank
Here is my code:
function InitField() {
<?php
$theName = $_SESSION['$Sess_Name'];
?>
var tempoVar = "<?php echo json_encode($theName); ?>";
var myInput = document.getElementById('theSurname');
myInput.value = tempoVar;
}