Hi I have the following PHP code on my web page, which when run produces error codes.
The php:
[php]
if(isset($_POST[‘Register’])) {
session_start();
$PID = $_POST['PID'];
$FName = $_POST['FN'];
$MN = $_POST['MN'];
$LN = $_POST['LN'];
$sql = $con->query("INSERT INTO person (PID, FN, MN, LN)Values('{$PID}','{$FName}','{$MN}','{LN}')");
}
[/php]
The error codes:
Notice: Undefined index: FN in C:\xampp\htdocs\MyTree\index.php on line 9
Notice: Undefined variable: con in C:\xampp\htdocs\MyTree\index.php on line 13
Fatal error: Uncaught Error: Call to a member function query() on null in C:\xampp\htdocs\MyTree\index.php:13 Stack trace: #0 {main} thrown in C:\xampp\htdocs\MyTree\index.php on line 13
I don’t see what the problem is - I am new to PHP but there must be a problem.
The database fields are the same as in the $_POST.
Any help would be appreciated.
Thanks