session_start(); require_once("config.inc.php"); secure_page("2"); sqlconnect(); if (isset($_POST['fname']) && isset($_POST['lname'])){ $fname = $_POST['fname']; $lname = $_POST['lname']; $company = $_POST['company']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone1 = $_POST['phone1']; $phone2 = $_POST['phone2']; $fax = $_POST['fax']; $email = $_POST['email']; $taxable = $_POST['taxable']; $accountnbr = $_POST['accountnbr']; $acctcode = $_POST['acctcode']; $taxID = $_POST['taxID']; $terms = $_POST['terms']; $query = "INSERT INTO `client` (`fname`,`lname`,`company`,`address`,`city`,`state`,`zip`,`phone1`,`phone2`,`fax`,`email`,`taxable`,`terms`,`taxID`,`balance`,`accountnbr`,`acctcode` ) VALUES('$fname','$lname','$company','$address','$city','$state','$zip','$phone1','$phone2','$fax','$email','$taxable','$terms','$taxID','0.00','$accountnbr','$acctcode');"; $result = mysql_query($query) or die(mysql_error()); $query = "SELECT Max(id) from client ORDER BY id DESC LIMIT 1"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); while($row = mysql_fetch_row($result)) {$cusid = $row[0];} header("Location:client.php?id=".$cusid.""); } else{ include_once("template.php"); head(); $resultx = mysql_query("SELECT Max(accountnbr) from `client` ORDER BY accountnbr DESC LIMIT 1;") or die(mysql_error()); while($row = mysql_fetch_row($resultx)) {$accountnbr = $row[0] + 1;} ?>