i am working on a php based password generator, i have a html form which has inputs for website name, Username and Passowrd. till now the user has to type the password so that it can get encrypted and stored , what i want is to have a button besides the password input form, which when clicked type the generated passoword in the password field.
this is the form i am using-
</head>
<body
<form class="form" method="post">
<!--Input Fields-->
<input type="text" name="website" placeholder="Website" required autocomplete="off"> <br>
<input type="text" name="username" placeholder="Username" required autocomplete="off"> <br>
<input type="password" name="password" placeholder="Password" required autocomplete="off"> <br>
<input type="submit" name="submit" value="SAVE" class="submit">
</form>
</div>
this is the function i want to get executed on press of the button-
function password_generate($chars)
{
$Uppercase="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$Lowercase="abcdefghijklmnopqrstuvwxyz";
$Numbers="1234567890";
$Symbols="!@#$&*+_?%";
$data = $Uppercase.$Lowercase.$Numbers.$Symbols;
return substr(str_shuffle($data), 0, $chars);
}