i have below code for store and set field value
<!DOCTYPE html>
<html>
<head>
<title>hjdsjhdsf</title>
</head>
<body>
<form name="nn" method="post">
<input type="text" name="name" onsubmit="kou()" id="tt">
<input type="submit" name="kk">
</form>
</body>
</html>
<?php
function kou(){
$Ul =$_POST['name'];
echo "<script>document.getElementById('tt').value=' . $Ul . '; </script>";
}
$UM =$_POST['name'];
if(array_key_exists('name', $_POST)){
ECHO "SDHDJ";
echo $UM;
}
?>
when user submit the form, when there is errors all conditions are shows, But user enter details are all gone. i want set what user enter value to set the same field as value