I have the following code within the <script>
tags, which are within the <head>
tags of my HTML file;
function generateUMR($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
Within the <body>
tags, I have the following line of code in order to output the randomly generated string;
echo '<script type="text/javascript"> generateUMR(); </script>';
I have been trying for a few hours now but I am receiving no output from this code, yet no errors, could someone please tell me where I am going wrong?
Thanks in advance.