Undefined index:

limited

New Member
hi someone tell me how to define


Notice: Undefined index: id in C:\xampp\htdocs\invoice\getcheckno.php on line 6

Notice: Undefined index: taxrate in C:\xampp\htdocs\invoice\getcheckno.php on line 7
PHP:
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'cookie';

$id = $_POST['id']; //
$taxrate = $_POST['taxrate']; //

$conn = mysql_connect($dbhost, $dbuser, $dbpass);
             if(! $conn ) { die('Could not connect: ' . mysql_error()); }
             else {mysql_select_db('homedb');}

mysql_query("UPDATE numbers SET checkno=checkno+1"); 
$result=mysql_query("select checkno from numbers") or die ("Error - could not retrieve checkno from database");
$data=mysql_fetch_assoc($result);
echo "checkno ".$data['checkno'];
mysql_close(); 
?>
 

TrainTrackHack

VIP Member
The POST request doesn't have fields named 'id' or 'taxrate'; this is a problem with your client-side code, not the php script (although it's good form to check if these values exists). You need to make sure that the variables 'id' and 'taxrate' are sent with the HTTP request. If you're using HTML forms, this means that you need to have input fields with names "id" and "taxrate" and the request method has to be post (you need method="post" in the opening form tag).
 
Top