If there is no value in the post, of course it is undefined. If you use a from form to submit to a page and receive the id value, it will not be reported as undefined
You can block warning level errors. Some versions of PHP will prompt warning errors that POST parameters do not exist. Officially launched to block non-fatal errors.
I feel that there is no id in add.html, so I feel that that line of code can be omitted.
Check whether
$_POST['id']
exists
First determine whether $_POST['id'] exists before using it
If there is no value in the post, of course it is undefined. If you use a from form to submit to a page and receive the id value, it will not be reported as undefined
Please post the error message
You can block warning level errors. Some versions of PHP will prompt warning errors that POST parameters do not exist. Officially launched to block non-fatal errors.