douding6266 2017-01-14 12:04
浏览 36
已采纳

Php代码中的一些错误[重复]

This question already has an answer here:

first file is index.php

<?php include('loginform.php');?>

second file is loginform.php

<?php
<html>
<body>
<form action="" method="post">
<label>Username</label>
<input type="text" name="username"><br>
<label>Password></label>
<input type="password" name="password"><br>
<input type="submit" name="submit" value="login">
</form>
<a href="register.php">Register here</a>
</body>
</html>
?>

third file is register.php

<html>
<body>
<form action="" method="post">
<label>FirstName</label>
<input type="text" name="firstname"><br>
<label>LastName</label>
<input type="text" name="lastname"><br>
<label>Email</label>
<input type="email" name="email"><br>
<label>UserName</label>
<input type="text" name="username"><br>
<label>Password</label>
<input type="password" name="password"><br>
<input type="submit" name="submit" value="Register">
</form>
</body>
</html> 

I have three files in the project first file is the index file which is shown whenever the user opens the website It contains two things login form and a link ie register here.So i have wrapped all this in one single php file loginform.php and included it in my index.php file so when I execute this in my localhost web server it shows a error like this Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\cms\loginform.php on line 2 How can I tackle this problem please tell me?

</div>
  • 写回答

1条回答 默认 最新

  • dourang6423 2017-01-14 12:06
    关注

    The loginform.php file isn't a PHP source file, it's just an HTML file. Remove the enclosing <?php and ?> from it and you should be OK.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)