开发者

syntax error, unexpected '<' [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

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">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜