please help me to get auto number based on selected date? i have working code for auto number but that's only for today/current date. what i want is if date options selected then auto number generated based on the date selected...

here is my sample code for current date

```
    $today=date("ymd");
    $query = "SELECT max(id) AS last FROM member WHERE id LIKE '$today%'";
    $hasil = mysql_query($query);
    $data  = mysql_fetch_array($hasil);
    $lastNoTransaksi = $data['last'];
    $lastNoUrut = substr($lastNoTransaksi, 8, 2);
    $nextNoUrut = $lastNoUrut + 1;
    $nextNoTransaksi = $today.sprintf('.%02s', $nextNoUrut);?>

```

this is my full code with html selected date

```
<?php
require("db.php");
$today=date("ymd");
$query = "SELECT max(id) AS last FROM member WHERE id LIKE '$today%'";
$hasil = mysql_query($query);
$data  = mysql_fetch_array($hasil);
$lastNoTransaksi = $data['last'];
$lastNoUrut = substr($lastNoTransaksi, 8, 2);
$nextNoUrut = $lastNoUrut + 1;
$nextNoTransaksi = $today.sprintf('.%02s', $nextNoUrut);?>

<form method="post">
<table align="center">
<tr ><td>Date</td>
<td><input type="date" name="date" /></td>
</tr>
<tr><td>Code</td>
<td>
<?php echo $nextNoTransaksi; ?></td>
</tr>
<tr >
<td>Name</td>
<td><input type="text" name="name" /></td>
</tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" value="Input" /></td>
</tr>
</table>

```

thanks so much for you kindly help