我有这个错误:解析错误:语法错误,意外'如果' (T_IF)

时间:2014-10-16 19:38:06

标签: php if-statement syntax

我遇到了问题,不明白为什么我会收到该错误,我在我的本地服务器上浏览该页面,当我尝试访问该文件时出现此错误,但如果您使用我的代码片段运行它在这个页面上显示如何。

<html>
    <head>
        <title>Ingresa Un Nuevo Articulo</title>
    </head> 

<body>
<form method="post" action="insert_post.php" enctype="multipart/form-data">

    <table width="600" align="center" border="10">

        <tr>

            <td align="center" bgcolor="yellow" colspan="6"><h1>Ingresa Un Nuevo Articulo Aqui</h1></td>

        </tr>

        <tr>

            <td align="right">Titulo Del Articulo</td>
            <td><input type="text" name="title" size="30"></td>

        </tr>

        <tr>

            <td align="right">Autor Del articulo</td>
            <td><input type="text" name="author" size="30"></td>

        </tr>

        <tr>

            <td align="right">Keywords Del articulo</td>
            <td><input type="text" name="keywords" size="30"></td>

        </tr>

        <tr>

            <td align="right">Imagen Del articulo</td>
            <td><input type="file" name="image"></td>

        </tr>

        <tr>

            <td align="right">Contenido Del Articulo</td>
            <td><textarea name="content" cols="30" rows="15"></textarea></td>

        </tr>

        <tr>


            <td align="center" colspan="6"><input type="submit" name="submit" value="Enviar Noticia"></td>

        </tr>

    </table>
</form>
</body>
</html>

<?php
include("includes/connect.php")

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

    echo $_post_title = $_POST['title'];
    echo $_post_date = date('d-m-y');
    echo $_post_author = $_POST['author'];
    echo $_post_keywords = $_POST['keywords'];
    echo $_post_content = $_POST['content'];
    echo $_post_image = $_POST['image']['name'];





}

2 个答案:

答案 0 :(得分:0)

包含行需要;

include("includes/connect.php");

答案 1 :(得分:0)

好像忘记了;

<?php
include("includes/connect.php");

if(isset($_POST['submit'])){
    echo $_post_title = $_POST['title'];
    echo $_post_date = date('d-m-y');
    echo $_post_author = $_POST['author'];
    echo $_post_keywords = $_POST['keywords'];
    echo $_post_content = $_POST['content'];
    echo $_post_image = $_POST['image']['name'];
}
?>

应该做的伎俩