syntax error, unexpected '<' [closed]
Seriously
Parse error: syntax error, unexpected '<' on line 22
Code s开发者_开发问答nippet from line 22:
<?php
//Submitting to ourselves via POST
<form method="post" action="<?php echo $PHP_SELF; ?>"/>
?>
Try this:
This is not working either:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" />
Only PHP code should be between <?php
and ?>
.
Remove the outer PHP tags:
<!-- Submitting to ourselves via POST -->
<form method="post" action="<?php echo $PHP_SELF; ?>"/>
Update:
I also changed the comment to an HTML comment. You don't want it showing up on the page. You could also just remove the comment, or do this:
<?php // Submitting to ourselves via POST ?>
<form method="post" action="<?php echo $PHP_SELF; ?>"/>
If you have HTML where PHP is expecting PHP code, you will get unexpected '<' errors, and if you have PHP where there should be HTML, it will show up on the webpage, unexecuted.
you have html code inside your PHP block
do this:
<?php ?>
//Submitting to ourselves via POST
<form method="post" action="<?php echo $PHP_SELF; ?>"/>
or just remove the first line entirely
Try this:
< form action=" < ?php $PHP_SELF; ?>" method="post">
By the way, submitting to yourself can be:
<form action="" method="post">
精彩评论