<?php


$query = mysql_query("SELECT po, PoNum FROM po ORDER BY PoNum DESC LIMIT 1");

$row = mysql_fetch_array($query);
$po = $row["po"];
list($one[0],$one[1]) = split('Po',$po);

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

if($index < 10)
{
	$index = "Po000".$index;
}else 
if($index < 100)
{
	$index = "Po00".$index;
}else if($index < 1000)
{
	$index = "Po0".$index;
}

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