dongluoqiu0255 2016-02-16 05:42
浏览 79

PHP语句出现在输入文本值上,而不是$ _POST值

I have written an PHP form and tested it on WAMP server and was working fine.

When I got it into the webserver, the value tag on the input divs of the form, appeared on the page displaying the PHP code, instead of the $_POST value.

<form class="form-horizontal" role="form" method="post" action="contactos.php">
    <!-- FORM RESULT -->
    <div class="form-group">
        <div class="col-sm-10 col-sm-offset-2">
            <?php echo $result; ?>
        </div>
    </div>
    <!-- END FORM RESULT -->
    <!-- FORM NAME -->
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label">Nome</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="name" name="name" placeholder="O seu nome." value="<?php echo htmlspecialchars(isset($_POST['name']) ? $_POST['name'] : ''); ?>"/>
            <p class="text-danger">
                <?php echo '$errName';?>
            </p>
        </div>
    </div>

I can't really find out what's happening since it does work on WAMP server, but not on my webserver.

This is what I get on my webserver host.

PHP appearing on input form value tag picture

enter image description here This is a fraction of the code since all the other inputs are a copy of the input div above to each other input.

Couldn't find any solution, so far. Any help would be appreciated.

  • 写回答

1条回答 默认 最新

  • dongqi7631 2016-02-16 16:29
    关注

    Although all the website worked properly when installed on a local server, when I got the website online, I asked to enable a new hosting solution in order to have more capabilities and the website kept displaying the behavior explained on the question.

    After testing the PHP functionality uploading a file with the phpinfo(), I realized that PHP was not active on my host.

    This was an error on my host setup, which took some time to fix.

    But the answer may be suitable to someone else who had similar problems. Check first if PHP is active on your webserver.

    Just write a file and name it something like version.php and write the following in it:

    <?php
         phpinfo();
    ?>
    

    Upload the file to the root of your website.

    Then go to your browser and enter www.yourwebsite.ext/version.php on the address bar.

    If you see the PHP info panel, you have PHP installed and active on your webserver.

    If you don't see this info, or just get a blank page, probably PHP is not active on your webserver.

    Thank you for all the feedback.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大