if (empty ($p_name)||empty ($p_detail)||empty ($p_price))
{
echo "<script>alert('กรอกข้อมูลไม่ครบ');history.back();</script>";
exit();
}
if (!is_numeric($p_price))
{
echo "<script>alert('ราคาต้องเป็นตัวเลข');history.back();</script>";
exit();
}
$sql = "insert into product
values(null,'$p_name','$p_detail','$p_price','$newname','$c_id')";
mysql_query($sql) or die ("error=$sql");
echo "<script>window.location='product.php';</script>"
?>