Open phpfileread.php and save it as phperrors.php.

You may have already seen some errors in PHP.  Normally it is because you got the spelling wrong or missed a quote or semi-colon.

Change the first $names variable to $name.  Save, upload and try and you should see something like this:

Notice: Undefined variable: names in E:\files\phperrors.php on line 23

If you don't see an error you will find out why below.

As with JavaScript undefined means something does not exist.  The line number is key.  It says the variable $names does not exists which is true.  Look at the line number but as before the actual error may be on a line before this one.

What if there is no error?

PHP servers can be set to show or not show errors.  When you create a proper site you should turn off errors because error messages can give hackers clues.  When writing code you want to see errors all the time so that you can fix them.  Add this code to your PHP template right at the top before the DOCTYPE

<?php
error_reporting(E_ALL);
ini_set("display_errors", TRUE);
/* error_reporting(0); */
?>

If you did not get an error when testing phperrors.php add the code to that page as well.

Save it and try it and you should now see the error.

The first two lines say to show all errors (you can also just show important ones) and to turn error display on.  The third line is commented out and so does not get executed.  For now you do not need it but if you publish a Web site so that anyone can use it you should move the comment symbols to turn off all error reporting:

/* error_reporting(E_ALL);
ini_set("display_errors", TRUE); */
error_reporting(0);

This example has commented out the first two lines so that you can easily turn errors back on later if you need to.

Types of error

A notice from the PHP server means the code is definitely broken and the page stopped working.

A warning from PHP means that something did not work as expected but the rest of the code might still work so it will give it a go.

You need to fix both types unless you understand a warning and know for sure that it is not important.  At this stage fix them all.