PHP 没有从联系表中获取数据(.htaccess?)

PHP not catching data from contact form (.htaccess?)

在解决我的问题后,我一直在网上四处寻找。我希望你们能帮助我。我已经在 Whosebug 上阅读了几篇关于 .htaccess 的帖子,但我还没有找到任何帮助。

在我的网站上(我的第一个,这是一个学习过程),timeforyou.tk,我有一个联系表 (contact.html) 指向 process.php(在同一文件夹中)它应该被处理的地方 - 取出值然后通过电子邮件发送。但是,$_REQUEST 数组似乎是空的,我怀疑 .htaccess 有问题。我php的能力很低,不知道.htaccess写什么。

.htaccess 是问题所在吗?我该如何编辑它才能正常工作?

代码 1 (contact.html):

<form id="formContact" action="process.php" method="post" enctype="text/plain">
                <!--Get or Post-->
                <ul>
                    <li><label>Company<br> <input type="text" name="company" id="company"></label></li>
                    <li><label>Name<br> <input type="text" name="name" id="name"></label></li>
                    <li><label>Email *<br> <input type="text" name="email" id="email"></label></li>
                    <li><label>Confirm email *<br> <input type="text" name="email_confirm" id="email_confirm" title="emails don't match, please try again"></label></li>
                    <li><label>Message *<br> <textarea name="feedback" id="feedback"></textarea></label></li>
                    <li style="text-align: right;"><input type="submit" value="Send message" name="submit1" id="submit"></li>
                    <li>* Mandatory fields</li>
                    <!--onfocus="this.value = ''--> 
                </ul>
            </form>

代码 2 (process.php):

<?php
print_r($_REQUEST);
/*
if(isset($_REQUEST['submit'])) {
    //To timeforyou
    $company = $_POST['company']; //company name of author
    $name = $_POST['name']; //name of author
    $from = $_POST['email']; //email of author
    $msgToAdmin = $_POST['feedback']; //message from author
    $timeforyou = 'admin@timeforyou.tk';
    $subject = $_POST['company'];
(...)
}
*/
?>

我一直在尝试不同的东西,在 print_r($_REQUEST); 之前只会显示 Array() .但是,现在甚至没有发生这种情况。相反,我只是被重定向到 error404.000webhost.com/?

.htaccess:

 # Do not remove this line, otherwise mod_rewrite rules will stop working
    RewriteBase /

    # supress php errors
    php_flag display_startup_errors off
    php_flag display_errors off
    php_flag html_errors off

    # enable PHP error logging
    php_flag log_errors on
    php_value error_log /home/a3786788/public_html/logs/PHP_errors.log

    # prevent access to PHP error log
    <Files PHP_errors.log>
    Order allow,deny
    Deny from all
    Satisfy All
    </Files>

我尝试按照此 site 获取错误日志,但它似乎不起作用(日志未更新)。

请帮助,有人。

普通表单不需要 .htaccess。页面 "error404.000webhost.com" 看起来像默认错误 404 文档。例如:http://www.timeforyou.tk/test1234.html 也重定向到 "error404.000webhost.com"。

也许你的文件名打错了? proccess.php? proccess.php.html ?

http://www.timeforyou.tk/process.php -> 重定向到 "error404.000webhost.com".

删除 .htaccess 文件。也许 RewriteBase "/" 是错误的。

PHP 不处理此 enctype text/plain.

检查:https://bugs.php.net/bug.php?id=33741

Valid values for enctype in tag are:

application/x-www-form-urlencoded

multipart/form-data

第一个是默认的,你甚至不需要写下来。第二个只在上传文件时需要。

我认为这不是您的 .htaccess 文件。 从表单中删除 enctype="text/plain" 。 PHP不处理