【问题标题】:I have this error: Parse error: syntax error, unexpected 'if' (T_IF) [closed]我有这个错误:解析错误:语法错误,意外的'if'(T_IF)[关闭]
【发布时间】:2014-10-16 19:38:06
【问题描述】:

我有一个问题,不明白为什么会出现这个错误,我在本地服务器上运行页面,当我尝试访问文件时出现这个错误,但是如果你和我一起运行它 sn-p在此页面上显示如何。

<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'];





}

【问题讨论】:

    标签: php if-statement syntax


    【解决方案1】:

    好像你忘记了;

    <?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】:

      包含行需要;

      include("includes/connect.php");
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-10-30
        • 1970-01-01
        • 2013-12-09
        • 2011-07-23
        • 2014-04-02
        相关资源
        最近更新 更多