PHP无法从联系人表单(.htaccess?)捕获数据
我一直在网上到处寻找解决我问题的方法。我希望你们能帮助我。我已经读过几篇关于stackoverflow.htaccess的帖子,但我还没有找到任何一篇有帮助的帖子 在我的网站(我的第一个网站,这是一个学习过程)上,我有一个联系表单(contact.html),它指向process.php(在同一个文件夹中),在那里它应该被处理——取出值,然后通过电子邮件发送。但是,$\u请求数组似乎是空的,我怀疑.htaccess有什么问题。我的php能力很低,我不知道用.htaccess写什么 是.htaccess问题吗?我如何编辑它才能工作? 代码1(contact.html):PHP无法从联系人表单(.htaccess?)捕获数据,php,html,forms,.htaccess,mod-rewrite,Php,Html,Forms,.htaccess,Mod Rewrite,我一直在网上到处寻找解决我问题的方法。我希望你们能帮助我。我已经读过几篇关于stackoverflow.htaccess的帖子,但我还没有找到任何一篇有帮助的帖子 在我的网站(我的第一个网站,这是一个学习过程)上,我有一个联系表单(contact.html),它指向process.php(在同一个文件夹中),在那里它应该被处理——取出值,然后通过电子邮件发送。但是,$\u请求数组似乎是空的,我怀疑.htaccess有什么问题。我的php能力很低,我不知道用.htaccess写什么 是.htacc
- 公司
- 名称
- 电子邮件*
- 确认电子邮件*
- 消息*
- *必填字段
代码2(process.php):
我一直在尝试不同的事情,在print\r($\u请求)之前只显示数组()。然而,现在,甚至这种情况也没有发生;相反,我只是被重定向到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>
#不要删除此行,否则mod#u重写规则将停止工作
重写基/
#suppress php错误
php_标志显示_启动_错误关闭
php_标志显示_错误关闭
关闭php_标志html_错误
#启用PHP错误日志记录
上的php_标志日志_错误
php_value error_log/home/a37867888/public_html/logs/php_errors.log
#阻止访问PHP错误日志
命令允许,拒绝
全盘否定
满足所有
我尝试通过以下方式获取错误日志,但它似乎不起作用(日志不会得到更新)
请帮助,有人。正常表单不需要.htaccess。页面“error404.000webhost.com”看起来像默认的error404文档。例如:也重定向到“error404.000webhost.com” 也许你的文件名有误?process.php?proccess.php.html ->重定向到“error404.000webhost.com”
删除.htaccess文件。可能RewriteBase“/”是错误的。PHP无法处理此enctype text/plain 检查: 标记中enctype的有效值为: 应用程序/x-www-form-urlencoded 多部分/表单数据
第一个是默认值,你甚至不需要写下来。s第二个文件仅在上载文件时才需要。我认为它不是您的.htaccess文件。 从表单中删除enctype=“text/plain”。
PHP无法处理它。确保process.PHP具有可执行权限!我同时删除了.htaccess和“enctype text/plain”。在我选择接受什么答案之前,我会检查哪一个做了这项工作。非常感谢。成功了!我同时删除了.htaccess和“enctype text/plain”。在我选择接受什么答案之前,我会检查哪一个做了这项工作。非常感谢。删除enctype=“text/plain”成功了!My.htaccess现在看起来如下所示(几乎没有变化):#不要删除此行,否则mod_rewrite rules将停止工作RewriteBase/。换句话说,.htaccess不是问题所在;enctype=“text/plain”被删除。非常感谢。
<?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'];
(...)
}
*/
?>
# 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>