I got an error:
Parse error: syntax error, unexpected end of file in the line
With this code:
I had the same error, but I had it fixed by modifying the php.ini
file.
Find your php.ini file see Dude, where's my php.ini?
then open it with your favorite editor.
Look for a short_open_tag
property, and apply the following change:
; short_open_tag = Off ; previous value
short_open_tag = On ; new value
Avoid this as well <? } ?>
make sure you put <?php } ?>
If your using parse_ini_file($file) or a routine is rading an .ini file, check if you data is quoted in the ini file. Unquoted data will cause this error. Ex; data1=test will cause the error, data1="test" will not.
You can't divide IF/ELSE instructions into two separate blocks. If you need HTML code to be printed, use echo.
<html>
<?php
function login()
{
// Login function code
}
if (login())
{
echo "<h2>Welcome Administrator</h2>
<a href=\"upload.php\">Upload Files</a>
<br />
<a href=\"points.php\">Edit Points Tally</a>";
}
else
{
echo "Incorrect login details. Please login";
}
?>
Some more HTML code
</html>
Just go to php.ini then find short_open_tag= Off
set to short_open_tag= On
You should avoid this (at the end of your code):
{?>
and this:
<?php}
You shouldn't put brackets directly close to the open/close php
tag, but separate it with a space:
{ ?>
<?php {
also avoid <?
and use <?php