tags:

views:

96

answers:

4

Seriously

Parse error: syntax error, unexpected '<' on line 22

Code snippet 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']; ?>" />
+4  A: 

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.

Blorgbeard
A: 

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

Scott Evernden
"//Submitting to ourselves via POST" will show in the markup in your case, and on the site as well, as this is a php comment, not an html one.
Residuum
Yeah, I just realized that I was coding my html code inside the <?php section ?> instead of out of the php section, thanks for the heads up with the comment that made me find this error.
Newb
A: 

Try this:

< form action=" < ?php $PHP_SELF; ?>" method="post">

Prasoon Saurav
A: 

By the way, submitting to yourself can be:

<form action="" method="post">
Vincent Robert