根据参数自动生成序列号 - php / mysql

A few day back i had ask a question about Auto generated sequence number staring from 001 .. and which was done.. but suddenly the request from client is change and he want something as below :

test.php?trans_no=3&pid=111&autoid=3 

test.php?trans_no=4&pid=112&autoid=5

as pass parameter is autoid=3 hence 001,002,003 sequence number should be generator with each next ADD button click ( means after clicking ADD button 001 should be store in my table and on next add button fire 002 and so on ).

autoid=5 hence 001,002,003,004,005 sequence number should be generator with each next ADD button click ( means after clicking ADD button 001 should be store in my table and on next add button fire 002 and so on ). llly all other ..

hence my main product id wil be as : 111-001 , 111-002 , 111-003 && 112-001,112-002,112-003,112-004,112-005 and so on and on as per pass parameter ( query string)

Please not its only ex of 3 , 5 number can be anything it can be autoid=200 or autoid=1 or autoid=50 etc..

Well, crudely (very crudely)...

<?php

if(isset($_GET['item'])){
$item = $_GET['item'];
$max_val = $_GET['max_val'];

for($i=1;$i<=$max_val;$i++){
echo $item."-".$i."<br>
";

}
}else {

?>

<form name = 'my_form' method='get' action='so_temp2.php'>

<input name = 'item' type = textbox/>

<select name = 'max_val'>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

<input type=submit />

</form>

<?

}
?>

or... if you just want to construct a simple insert...

<?php

if(isset($_GET['item'])){
$item = $_GET['item'];
$max_val = $_GET['max_val'];

echo "INSERT INTO my_table (item,max_val) VALUES ($item,$max_val);";

}else {

?>

<form name = 'my_form' method='get' action='so_temp2.php'>

<input name = 'item' type = textbox/>

<select name = 'max_val'>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

<input type=submit />

</form>

<?

}
?>