<?php
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);

$query = mysql_query("SELECT StaffID, StaffNum FROM staff ORDER BY StaffNum DESC LIMIT 1");
$row = mysql_fetch_array($query);
$StaffID = $row["StaffID"];
list($one[0],$one[1]) = split('S',$StaffID);

$index = ++$one[1];
$StaffNum = $index;

if($index < 1000)
{
	$index = "S".$index;
}


echo "<input type='hidden' name='StaffID' value='".$index."'><input type='hidden' name='StaffNum' value='".$StaffNum."'>".$index;
?>