Io ho fatto così:
Codice PHP:
<?php
function randomPassword () {
$length ="8"; // the length of the password required
$possible = '0123456789' .
'abcdefghijkmnpqrstuvwxyz' ;
$str ="";
while (strlen($str) < $length) {
$str.=substr($possible, (rand() % strlen($possible)),1);
}
return($str);
}
?>
<form id="form1" name="form1" method="post" action="">
<input type="submit" name="Submit" value="Genera password" />
<input name="textfield" type="text" value="<?php echo randomPassword(); ?>" />
</form>
anche se la password si vede subito...
vabbè almeno mi funziona