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 displays the value of $row['firstName'] correctly.
$str = $row['firstName'];
This code gets the value of $str and tries to display it in a text box called txtTitle.
Im pulling my hair out with this. I have searching through forums and i havent found any help.
var val = <?php echo json_encode($str); ?>;
document.getElementById("txtTitle").value = val;
Thanks in advance