PHP errors:



ERROR: Browser does not execute the PHP file. The PHP code is displayed in the browser, instead of being executed.

FIX: Run the code through the web server, instead of double-clicking the file. Check your address line in the browser. If the address starts with file:///W:/ it means that you did not run the code through the web server. Change the address in the address bar of your browser to be something like  


ERROR: Parse error: parse error, unexpected T_VARIABLE in C:\wamp\www\process_name_age.php on line 17

FIX: a semicolon ; is probably missing on the previous line (last code line above 17)


ERROR: Parse error: parse error, unexpected $end in C:\wamp\www\process_name_age.php on line 33

FIX: the curly braket } to end a block of code is probably missing. Check your if, while, for, foreach statements


ERROR: Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in C:\wamp\www\process_name_age.php on line 31

FIX: make sure the variable name on line 31 starts with a letter, not a number.


ERROR: Parse error: parse error, unexpected '}' in C:\wamp\www\process_name_age_oo.php on line 30

FIX: either there is no matching open curly bracket }, or you forgot a semicolon at the end of the previous code line


ERROR: _POST[‘myfieldhere’] not defined

FIX: STEP 1: Make sure the value of “name” attribute in the HTML input field is indeed ‘myfieldhere’, including capitalization since variable names are case sensitive. Example: <input type = “text” name = ‘myfieldhere’/>

STEP 2: Make sure the input field is in a form! (you have the start form tag <form action =… method = …> somewhere before the input field named “myfieldhere”, and end form tag </form> somewhere after the input field )   


ERROR: _SESSION not defined

FIX: Make sure you have the session_start() command at the beginning of any script that uses session variables.



ERROR: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\session1.php on line 4

FIX: Make sure there is no variable like $_POST[‘something’] inside a string. PHP does not like the single quotes used to specify associative arrays to be used inside double quotes. For example use 

echo “<p>Value for the variable is ”. $_POST[‘something’] . “</p>”;  

instead of

echo “<p>Value for the variable is  $_POST[‘something’]  </p>”;  //this will lead to errors