Undefined index/variable

what is wrong with the below code re. the rate? the invno works in the program I’m using this in.

<?php  
mysql_connect("localhost","root","");   
mysql_select_db('numbersdb') or die( "Unable to select database");   
if(!empty($_POST["submit"]))   
{   
$invno = $_POST['invno'];   
$rate = $_POST['rate'];   
}   
mysql_query("UPDATE numbdata SET invno=invno+1");   
$result=mysql_query("select invno from numbdata") or die ("Error - could not retrieve invoice# from database");  
$data=mysql_fetch_assoc($result);  
mysql_close();  
?> 

Show us your form.

PS: Might want to not broadcast the fact that you’re using that particular username and password combination for your database.

the posted code, an include , “getinvno.php” is used in a subsequent program using the invno and the rate. I am posting the code that uses it, here.

<?php
include("getinvno.php");
mysql_connect("localhost","root","");
mysql_select_db('posdb') or die( "Unable to select database");
$query=" SELECT * FROM postable WHERE sellqty > 0";
$result=mysql_query($query);
$num=mysql_num_rows($result);
echo date("m/d/Y") . "<br />";
echo "<center><font size=+2><b> Kirk Pawn, Gun & Archery</font><br />";
echo "9921 Old Bearskin Rd<br />";
echo "Hunters Den, Alabama  32145<br /></center>";
echo "customer# ".$data['invno'];
echo " </b><br />";
echo "<table cellspacing=5 cellpadding=0 border=0>
<tr>
<th align=left>sell</th>
<th colspan=2></th>
<th>unit</th>
<th></th>
<th></th>
<tr>
<th align=left>qty</th>
<th>item#</th>
<th>item</th>
<th>price</th>
<th>charge</th>
 </tr>";
while($row = mysql_fetch_array($result))
{
$amtdue = $row['unitprice'] * $row['sellqty'];
$tax = $amtdue * $data['rate'];  
$tottax = $tottax + $tax; 
$totdue = $totdue + $amtdue; 
$totdue = $totdue + $tottax;
echo "<tr>";
echo "<td>" . $row['sellqty'] . "</td>";
echo "<td>" . $row['itemno'] . "</td>";
echo "<td>" . $row['itemdescr'] . "</td>";
echo "<td align=right>" . $row['unitprice'] . "</td>";
echo "<td align=right>" . sprintf("%.2f",$amtdue) .
"</td>"; 
}
echo "<tr>";
echo "<td>Tax</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td align=right>" . sprintf("%.2f",$tottax) .
"</td>";   
echo "<tr>";
echo "<td>Total</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td align=right>" . sprintf("%.2f",$totdue) .
"</td>";
echo "</tr>";
echo "</table>";
echo "<tr>";
echo "<font size=+1><b>We thank you for your business</b>";
mysql_close();
?> 

You still havent shown me your form. I need to see what’s supposed to be filling $_POST[‘rate’], not what you do with it afterwards…