here if i click the Generate Employee Id button it should generate the random number in input textfield and then that button should hide after generate the id. how to do that? but, i can automatically generate the random number in input textfiled without the button. that code is below i'm posting. i want to use button here.. any help...??
<td><input type="text" name="emp" readonly="readonly" value="" /></td>
<td><input type="button" value="Generate Employee Id" onclick="" /></td>
this is the code for generate auto random number in input textfield without button..
<input type="text" name="emp" readonly="readonly" value="<?php
function gen_random_string($length=6)
{
$chars ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
$final_rand ='';
for($i=0;$i<$length; $i++)
{
$final_rand .= $chars[ rand(0,strlen($chars)-1)];
}
return $final_rand;
}
echo gen_random_string()."\n"; //generates a string
?>" />