-1

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?

1 Answers1

0

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.

Mureinik
  • 297,002
  • 52
  • 306
  • 350