Apologies, I hit enter by mistake and apparently there is no "edit" option of posts you've already made!
Here is the code:
<?php
class Products
{
var $name;
function getName()
{
return $this->$name;
}
function addProduct($name, $price, $sale, $desc, $status, $category)
{
$sql = "INSERT INTO products VALUES($name, $price, $sale, $desc, $status, $category)";
if(mysql_query($sql))
{
return true;
}
}
}
?>
<!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>
<title>Products</title>
</head>
<body>
<?php
$products = new Products();
if($products->addProduct("Product 1","23.50","1","This is a description","Staus","2"))
{
echo "Product Added";
}
?>
</body>
</html>