Monday, December 1, 2008

Unexpected T_VARIABLE or T_ECHO variable error in PHP

If you are newbie in PHP programming, you may have encountered to above problem. It is just a minor error. But, the nature of error message is some tricky. Generally, the message comes like this.


Parse error: parse error, unexpected T_ECHO in F:\Websites\AptechKtm\Course\index.php on line 246


I found this error in following lines.


$dob = $_POST['ddl_DOTYear'].$_POST['ddl_DOTMonth'].$_POST['ddl_DOTDate']



The error has come due to not placing semicolon (;) mark at the end of first statement to mark the end of that statement. So, the PHP engine found echo keyword unexpectedly. Hence, the error message.