我非常感谢教育资源,资源和解决方案。 Apache日志(MAMP Prro,Mac OS Mojave)中显示以下消息:
“脚本 '/Applications/MAMP/htdocs/MyCMS/Insert_into_Database_LS_v2.php'不是 找到或无法统计,引荐来源: http://localhost:8888/MyCMS/Insert_into_Database._LS_v2.php…”
填写表单后单击“提交”时,出现错误消息。有问题的文件在正确的位置。
所有相关的PHP和HTML代码(“包含的”文件中的内容除外)均包含上述文件-即“ Insert_into_Database_LS_v2.php”。因此,通过单击Submit,我在同一文件中发出了对PHP代码的调用。这是我做错了吗?
仅在以下情况相关的情况下,才是上述错误消息之前的其他错误消息:
客户端被服务器配置拒绝: /Applications/MAMP/htdocs/.DS_Store客户端被服务器拒绝 配置:/Applications/MAMP/htdocs/.htaccess文件不 存在:/Applications/MAMP/htdocs/apple-touch-icon-precomposed.png 文件不存在:/Applications/MAMP/htdocs/favicon.ico,引荐来源: http://localhost:8888/文件不存在: 服务器拒绝了/Applications/MAMP/htdocs/apple-touch-icon.png客户端 配置:/Applications/MAMP/htdocs/MyCMS/.DS_Store,引荐来源: http://localhost:8888/文件不存在: /Applications/MAMP/htdocs/favicon.ico,引荐网址: http://localhost:8888/MyCMS/文件不存在: /Applications/MAMP/htdocs/favicon.ico,引荐网址: http://localhost:8888/MyCMS/Insert_into_Database._LS_v2.php
这似乎是我的代码的相关部分:
<?php
require_once("Include/DB_LS.php");
if (isset($_POST["Submit"])) {
if (!empty($_POST["First name"])&&!empty($_POST["Last name"])) {
$FirstName = $_POST["First name"];
$LastName = $_POST["Last name"];
etc.
global $ConnectingDB;
$sql = "INSERT INTO MemberTable(FirstName,LastName,Degree,EmailAdrs,Phone,Country,City,Interest)
VALUES(:fnamE,:lnamE,:degreE,:emaiL, :phoN, :countrY, :citY, :interesT)";
$stmt = $ConnectingDB->prepare($sql);
$stmt->bindValue(':fnamE',$FirstName);
$stmt->bindValue(':lnamE',$LastName);
…
?>
…
<div>
<form class="" action="Insert_into_Database_LS_v2.php" method="POST">
<div class="container">
<h1>Register</h1>
<p>Please fill in this form to create an account.</p>
…
<button type="submit" class="registerbtn">Register</button>
</div>
etc.