-2
<form action="form1.php"  method="POST">
    username <input type="text" name="username"><br />
    password <input type="password" name="password"><br />
    <input type="submit" name="submitbutt" value="Login!"><br />
</form>

when to add the lines on the code,the procedure runs error :

Parse error: syntax error, unexpected '<' in C:\wamp\www\form1.php on line 2

<?php
<form action="form1.php"  method="POST">
    username <input type="text" name="username"><br />
    password <input type="password" name="password"><br />
    <input type="submit" name="submitbutt" value="Login!"><br />
</form>
?>
showkey
  • 482
  • 42
  • 140
  • 295

2 Answers2

2

You're putting HTML in a PHP block, so your web server is trying to parse the HTML as PHP - and fails, so you get an error back.

All you have to do is not enclose it in <?php ... ?>, and the HTML will show nicely. You only have to use <?php ... ?> when you have actual PHP code to place within it.

Joel Hinz
  • 24,719
  • 6
  • 62
  • 75
1

echo the html code...

<?php
echo '<form action="form1.php"  method="POST">
    username <input type="text" name="username"><br />
    password <input type="password" name="password"><br />
    <input type="submit" name="submitbutt" value="Login!"><br />
</form>';
?>

Or use only html

<?php #your php code ?>
<form action="form1.php"  method="POST">
    username <input type="text" name="username"><br />
    password <input type="password" name="password"><br />
    <input type="submit" name="submitbutt" value="Login!"><br />
</form>
<?php #your php code ?>
user3419778
  • 856
  • 3
  • 8
  • 11