I want to add data in my table (products)..
I got undefined index warning.
This is the warning:
Notice: Undefined index: prodid in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: prodname in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: description in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: amount in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: stocks in C:\xampp\htdocs\pos\addmessage.php on line 4
This is my code.
<?php
mysql_connect("localhost","root","");
@mysql_select_db("pointofsales") or die ("Unable to connect");;
$sql=mysql_query("INSERT INTO products(prodid, prodname, description, amount, stocks)VALUES('$_POST[prodid]','$_POST[prodname]','$_POST[description]','$_POST[amount]','$_POST[stocks]')");
mysql_query($sql);
mysql_close();
echo "Record is added successfully";
?>
I'm just a beginner. please help. thanks!
I got undefined index warning.
This is the warning:
Notice: Undefined index: prodid in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: prodname in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: description in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: amount in C:\xampp\htdocs\pos\addmessage.php on line 4
Notice: Undefined index: stocks in C:\xampp\htdocs\pos\addmessage.php on line 4
This is my code.
<?php
mysql_connect("localhost","root","");
@mysql_select_db("pointofsales") or die ("Unable to connect");;
$sql=mysql_query("INSERT INTO products(prodid, prodname, description, amount, stocks)VALUES('$_POST[prodid]','$_POST[prodname]','$_POST[description]','$_POST[amount]','$_POST[stocks]')");
mysql_query($sql);
mysql_close();
echo "Record is added successfully";
?>
I'm just a beginner. please help. thanks!