我解决了问题后,我一直在网上搜索高低。我希望你们能帮助我。我已经阅读了有关.htaccess的stackoverflow上的几篇帖子,但我还没有找到任何帮助。
在我的网站上(我的第一个,它是一个学习过程),timeforyou.tk,我有一个联系表单(contact.html),它指向process.php(在同一文件夹中)应该被处理 - 取出的值然后通过电子邮件发送。但是,$ _REQUEST数组似乎是空的,我怀疑与.htaccess有关。我的PHP能力非常低,我不知道该写什么.htaccess。
.htaccess是问题,如何编辑它?
Code1(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)之前; 只会显示数组()。然而,现在,甚至不会发生这种情况;相反,我只是被重定向到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获取错误日志,但似乎无效(日志未更新)。
请帮助,某人。
答案 0 :(得分:0)
您不需要.htaccess作为普通表格。页面&#34; error404.000webhost.com&#34;看起来像默认错误404文档。例如:http://www.timeforyou.tk/test1234.html还重定向到&#34; error404.000webhost.com&#34;。
也许你的文件名中有拼写错误? proccess.php? proccess.php.html?
http://www.timeforyou.tk/process.php - &gt;重定向到&#34; error404.000webhost.com&#34;。
删除.htaccess文件。也许RewriteBase&#34; /&#34;是错的。
答案 1 :(得分:0)
PHP不处理此enctype text / plain 。
检查:https://bugs.php.net/bug.php?id=33741
标记中enctype的有效值为:
应用程序/ x-WWW窗体-urlencoded
的multipart / form-data的
第一个是默认值,你甚至不需要把它写下来。 Ssecond one只在上传文件时才需要。
答案 2 :(得分:0)
我认为这不是你的.htaccess文件。 从表单中删除enctype =“text / plain”。 PHP无法处理它。