Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用html格式的外部php文件_Php - Fatal编程技术网

使用html格式的外部php文件

使用html格式的外部php文件,php,Php,我正在尝试创建简单的用户注册表单。我有一个index.html文件和一个register.php文件。当我单击submit按钮时,它会进入register.php页面,但什么也没发生。没有任何错误。我在register.php中有一些echo语句,但它们也不起作用 这是index.html的代码: <form action="register.php" method="post"> <table width="384" border="1" align="center">

我正在尝试创建简单的用户注册表单。我有一个
index.html
文件和一个
register.php
文件。当我单击submit按钮时,它会进入
register.php
页面,但什么也没发生。没有任何错误。我在
register.php
中有一些
echo
语句,但它们也不起作用

这是
index.html
的代码:

<form action="register.php" method="post">
<table width="384" border="1" align="center">
<? echo '<tr><td colspan="2">'.$final_report.'</td></tr>';?>
<tr>
<td width="50%">Username:</td>
<td width="50%"><label>
  <input name="username" type="text" id="username" size="30" />
</label></td>
</tr>
<tr>
  <td>Password:</td>
  <td><input name="password" type="password" id="password" value="" size="30" /></td>
</tr>
<tr>
  <td>Email:</td>
  <td><input name="email" type="text" id="email" size="30" /></td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><label>
    <input name="register" type="submit" id="register" value="Register" />
  </label></td>
</tr>
  </table>
  </form>    
有人能看到错误吗

include_once"config.php"
你好像少了一块地方。要么让它
包含一次“config.php”
(注意中间的空格),要么
包含一次(“config.php”)

您还在
register.php
中设置了
$final\u report
,但我看不出您实际上在哪里打印任何内容


编辑:我看到您正试图在
index.php
中打印
$final\u report
。除非将
register.php
代码直接包含到
index.html
中,否则这不会像您期望的那样工作。你为什么不创建一个包含注册脚本和HTML代码的
register.php
文件呢?

我将主页设置为index.HTML,然后将其包含在表单中进行注册。如果在index.HTML文件中也包含php脚本,那么我应该将其更改为index.php。我有几个与index.html相关的页面,你已经在index.html中使用了PHP代码(
)。如果这是可行的,那么在那里添加更多代码应该不会有任何问题。(默认情况下,许多web服务器会将HTML文件解析为PHP。)
include_once"config.php"