2014-01-27 122 views
-7

我檢查了一切。它仍然沒有工作,當我把分號(;)在第6行它說

Parse error: syntax error, unexpected ';' in line 6 

我該怎麼辦?這裏是我的代碼:

<?php 

if(isset($_POST['logintoadminpanel'])) 
( 

    include_once 'connection.php'; 

    $username = $_POST['username']; 
    $password = $_POST['password']; 


    if(empty($username) || empty($password)) 
    (
     echo "Please fill the required fields"; 
    ) 
) 
?> 
+0

這是一個語法錯誤。檢查你的文件可能你缺少分號(;) –

回答

4

您正在使用parens塊。你需要使用大括號。

if (...) 
{ 
    ... 
} 
1

使用{}代替()for if條件。

<?php 

if(isset($_POST['logintoadminpanel'])) 
{ 

    include_once 'connection.php'; 

    $username = $_POST['username']; 
    $password = $_POST['password']; 


    if(empty($username) || empty($password)) 
    { 
     echo "Please fill the required fields"; 
    } 
} 
?> 
0
Please check below tested code.. 

<?php 

if(isset($_POST['logintoadminpanel'])) 
{ 

    include_once ('connection.php'); 

    $username = $_POST['username']; 
    $password = $_POST['password']; 


    if(empty($username) || empty($password)) 
    { 
     echo "Please fill the required fields"; 
    } 
} 
?> 
相關問題