开发者

syntax error, unexpected '<' [closed]

开发者 https://www.devze.com 2022-12-12 22:37 出处:网络
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 applic
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

精彩评论

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