I keep getting the following error and cant seem to figure out where I'm going wrong with the code and have tried changing it but just seem to make is worse wonder could someone please help me, the code i am using is as follows:
this is the code for deleteCus.php
<?php
include ('db.php');
$delid=$_POST["cname"];
$str="delete from customer where customerid =$cid ";
print $str;
mysql_query($str);
?>
This is code that i am using wit AJAX in it
<?php
include ('functions.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registeration</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="JSFunctions.js"/>
<script src="../includes/ice/ice.js" type="text/javascript"></script>
</script>
<style type="text/css">
#container #main centre {
text-align: center;
}
</style>
</head>
</html>
<body>
<div id="container" ice:editable="*">
<div id="top">
<div id="logo">
<h1>Small Business Database </h1>
</div>
</tr>
</table>
</div>
<div id="navigation">
<div id="nav">
<div align="center">
<table>
<td>
<tr><a href="home.php"><em></em> Homepage</a></tr>
<tr><a href="Products.php"><em></em>Products</a></tr>
<tr><a href="Orders.php"><em></em>Orders</a></tr>
<tr><a href="Invoices.php"><em></em>Invoices</a></tr>
<tr><a href="Suppliers.php"><em></em>Suppliers</a></tr>
</td>
</table>
</div>
</div>
<div id="subnav">
<div align="justify">
<ul class="dropdown">
<li> <a href="Customer.php">Customers</a>
<ul class="sub_menu">
<li><a href="Customer_add.php">Add</a></li>
<li><a href="edCustomer.php">Edit</a></li>
<li><a href="deleteCustomer.php">Delete</a></li>
<li><a href="">Lookup</a></li>
</ul>
</li>
<li> <a href="Products.php">Products</a>
<ul class="sub_menu">
<li><a href="Products_add.php">Add</a></li>
<li><a href="Products_edit.php">Edit</a></li>
<li><a href="Products_delete.php">Delete</a></li>
<li><a href="Products_lookup.php">Lookup</a></li>
</ul>
</li>
<li> <a href="Invoice.php">Invoices</a>
<ul class="sub_menu">
<li><a href="Invoice_add.php">Add</a></li>
<li><a href="Invoice_edit.php">Edit</a></li>
<li><a href="Invoice_delete.php">Delete</a></li>
<li><a href="Invoice_lookup.php">Lookup</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<p><!-- close top--><!--/main-->
</div>
</p>
<p> </p>
<p> </p>
<p> </p>
<div align="left" id="page-wrap">
<p>Delete Customer Form </p>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script>
$(document).ready(function(){
$("#customer").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
$.ajax
({
type: 'POST',url:'DelDetails.php',data: dataString, cache: false,success: function(html)
{
$('.details').html(html);
}
});
});
});
</script>
<form method="post" name ="theForm" id="theForm" >
<table width='797' height="45" id='details'>
<tr>
<td width="789" colspan="2"><select name='cusname' id='customer' >
<?php customerList(); ?>
</select>
<input type='button' value='Select Customer' name='submit' id='submit' /></td>
</tr>
</table>
</form>
<br/>
<div id="details" class="details"></div>
</div>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
<?php
include("functions.php");
$id=$_POST['id'];
$myArray=array();
$myArray=getCustomerDetails($id);
print "<form method='POST' action='deleteCus.php'>";
print "<table>";
print "<tr><td>Customer Name</td><td><input name='cname'type='text' size=30 value='$myArray[1] '></input></td></tr>";
print "<tr><td>Address Line 1</td><td><input name ='caddress' type='text' size=30 value='$myArray[2] '></input></td></tr>";
print "<tr><td>Address Line 2</td><td><input name='caddress1' type='text' size=30 value='$myArray[3] '></input></td></tr>";
print "<tr><td>Address Line 3</td><td><input name='caddress2' type='text' size=30 value='$myArray[4] '></input></td></tr>";
print "<tr><td> County</td><td><input name='county' type='text' size=30 value='$myArray[6] '></input></td></tr>";
print "<tr><td>Postcode</td><td><input name='cpostcode' type='text' size=30 value='$myArray[5] '></input></td></tr>";
print "<tr><td> Telephone Number</td><td><input name='ctelephone' type='text' size=30 value='$myArray[7] '></input></td></tr>";
print "<tr><td>Email</td><td><input name='cemail' type='text' size=30 value='$myArray[8] '></input></td></tr>";
print "<tr style='display:none'><td>Email</td><td><input name='cid' type='text' size=30 value='$myArray[0] ' ></input></td></tr>";
print "</table>";
print "<input type='submit' value='Delete' onSubmit alert('Are you Sure you want to Delete This Customer')/> <br />";
print "</form>";
?>
<?php
include ('db.php');
$cid=$_POST["cid"];
$cname=$_POST["cname"];
$cusadd1=$_POST["caddress"];
$cusadd2=$_POST["caddress1"];
$cusadd3=$_POST["caddress2"];
$ccounty=$_POST["county"];
$custpc=$_POST["cpostcode"];
$custele=$_POST["ctelephone"];
$cusemail=$_POST["cemail"];
print $cid;
$str="select * from CustomerName='$cname',CustomerAddress='$cusadd1',CustomerAddress1='$cusadd2',CustomerAddress2='$cusadd3',County='$ccounty',CustomerPostCode='$custpc',CustomerTelNo='$custele',CustomerEmail='$cusemail' where customerid=$cid";
print $str;
mysql_query($str);
?>