I want to autofill the user form when a user is selected. How can I pass through an array from php to javacript/jquery and then put the values into the correct textboxes?
$("#client").change(function() {
$.get("../jquery/update_client.php?id=" + $("#client").val(),function(data){
$("#first").val(data);
});
});
PHP file:
if(isset($_GET['id'])){
include('../db_connect.php');
$id = mysqli_real_escape_string($mysqli, $_GET['id']);
$query = "SELECT * FROM users WHERE iduser=$id LIMIT 1";
$result = $mysqli->query($query);
$row = $result->fetch_array();
echo $row[];
}
How can I capture the array in javacript/jquery and then parse the information to go into the right boxes?