PHP Notice: Undefined index:
Posted: Wed Aug 25, 2004 9:25 pm
I created an HTML form and PHP script to add records to a database. The
script works and the records are added, but the intermediate variables
cause a PHP Notice: Undefined index: error to appear in the Apache
error_log.
Code:
<?
$ide = $_POST["Ide"];
$usr = $_POST["User"];
$pas = $_POST["Pass"];
$pin = $_POST["Pin"];
$alt = $_POST["Alt"];
$lot = $_POST["Lot"];
$db = mysql_connect("localhost","root");
mysql_select_db("list",$db);
$query="INSERT INTO Table1 (Ident,Username,Password,Pin,Alt,Lot) VALUES ('$ide','$usr','$pas','$pin','$alt','$lot')";
mysql_query($query,$db);
mysql_close();
?>
I have searched this forum to an answer to this question but have
found nothing satisfactory, even running to turning off error notices.
I don't think turning off error notices is the way to go, so I would
like to find the cause of these notices and alter the code accordingly.
Any suggestions?
TIA
script works and the records are added, but the intermediate variables
cause a PHP Notice: Undefined index: error to appear in the Apache
error_log.
Code:
<?
$ide = $_POST["Ide"];
$usr = $_POST["User"];
$pas = $_POST["Pass"];
$pin = $_POST["Pin"];
$alt = $_POST["Alt"];
$lot = $_POST["Lot"];
$db = mysql_connect("localhost","root");
mysql_select_db("list",$db);
$query="INSERT INTO Table1 (Ident,Username,Password,Pin,Alt,Lot) VALUES ('$ide','$usr','$pas','$pin','$alt','$lot')";
mysql_query($query,$db);
mysql_close();
?>
I have searched this forum to an answer to this question but have
found nothing satisfactory, even running to turning off error notices.
I don't think turning off error notices is the way to go, so I would
like to find the cause of these notices and alter the code accordingly.
Any suggestions?
TIA