thats not the problem.....the problem is when there is nothing stored in step.
http://localhost/chrisauto/invoice.php <=== on this link
Notice: Undefined index: step in D:\xampp\htdocs\chrisauto\invoice.php on line 3 <=== getting this error.
heres the code.
<?PHP
include('header.php');
switch($_REQUEST['step']){
default:
echo '[<a href="invoice.php?step=new">Create a new invoice</a>]<br/><br/>';
$pullinvoice = mysql_query("SELECT iid, customer FROM invoice ORDER BY iid")or die('There is no invoices. Make one?');
echo '<table border="1" cellpadding="5" cellspacing="0"><tr><td>Invoice ID</td><td width="200">Customer</td><td>Options</td></tr>';
while($invoice = mysql_fetch_array($pullinvoice)){
echo '<tr><td>'.$invoice['iid'].'</td><td>'.$invoice['customer'].'</td><td>[<a href="invoice.php?step=edit&inv='.$invoice['iid'].'">Edit</a>] [<a href="invoice.php?step=delete&inv='.$invoice['iid'].'">Delete</a>]</tr>';
}
echo '</table>';
break;
case 'edit':
$info = mysql_fetch_array(mysql_query("SELECT * FROM invoice WHERE iid=".$_REQUEST['inv']))or die('Invalid Invoice. Does not exist.');
echo '<form action="invoice.php?step=update&inv='.$info['iid'].'" method="post">';
echo '<table cellpadding="5" cellspacing="0">';
echo '<tr><td>Customer</td><td><input type="text" name="customer" value="'.$info['customer'].'"></td></tr>';
echo '<tr><td valign="top">Bill Address</td><td><textarea rows="5" name="baddress">'.$info['baddress'].'</textarea></td></tr>';
echo '<tr><td>Make</td><td><input type="text" name="make" value="'.$info['make'].'"></td></tr>';
echo '<tr><td>Model</td><td><input type="text" name="model" value="'.$info['model'].'"></td></tr>';
echo '<tr><td>Year</td><td><input type="text" name="year" value="'.$info['year'].'"></td></tr>';
echo '<tr><td>ODO Read</td><td><input type="text" name="odoread" value="'.$info['odoread'].'"></td></tr>';
echo '<tr><td>VIN</td><td><input type="text" name="vin" value="'.$info['vin'].'"></td></tr>';
echo '<tr><td colspan="2"><center><input type="submit" value="Update"></center></td></tr></table></form>';
break;
case 'update':
echo $_REQUEST['baddress'];
mysql_query("UPDATE invoice SET customer='".$_REQUEST['customer']."', `baddress`='".$_REQUEST['baddress']."', make='".$_REQUEST['make']."', model='".$_REQUEST['model']."', year='".$_REQUEST['year']."', odoread='".$_REQUEST['odoread']."', vin='".$_REQUEST['vin']."' WHERE iid=".$_REQUEST['inv'])or die(mysql_error());
//Header("Location: invoice.php?step=edit");
break;
}
include('footer.php');
?>