The array is created from a MySQL query:
$sql="SELECT * FROM tblEmployees WHERE employeeID = '".$q."'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$str = $row['firstName'];
$str displays the value of $row['firstName'] correctly.
This code gets the value of $str and tries to display it in a text box called txtTitle.
var val = <?php echo json_encode($str); ?>;
document.getElementById("txtTitle").value = val;
Im pulling my hair out with this. I have searching through forums and i havent found any help.
Thanks in advance