in my project i'm using user input form. that form contains serial no, reference no, name, email, phone, address, etc.., in that user input form serial number textfield is readonly option. user can't able edit the serial number. in that textfield i want to show the next auto_increment id from mysql database. how to do that? for example if i have entered 150 rows in mysql database. then whenever user enter that input form serial number textfield should show 151 (next auto_inc id). any help ???
<tr>
<td width="175" height="30" class="smalltext">Serial Number :</td>
<td width="214" class="textbox"><input style="font-weight:bold;" type="text" name="serial" value="<?php ?>" readonly="readonly"/></td>
<td width="511"> </td>
</tr>
<tr>
<td width="175" height="30" class="smalltext">Reference Number :</td>
<td width="214" class="textbox"><input style="font-weight:bold;" type="text" name="reference" 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
?>" readonly="readonly" /></td>
<td> </td>
</tr>