Here is the code:

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <? if ($_SERVER['REQUEST_METHOD'] == 'POST'), name="Vasya" { echo "<h1>Привет, хозяин!</h1>"; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { echo "<h1>Привет, <b>" . $_POST['name'] . "</b>!</h1>"; } ?> <form method="POST"> Введите Ваше имя: <input type="text" name="name"> <br> <input type="submit" name="okbutton" value="OK"> </form> </body> </html> 

As many have already understood, the task of the code is to display the message "Hello, master!", If a person entered Vaysa, if something else, then simply "Hello, the name of a person!". But a syntax error occurs:

Parse error: syntax error, unexpected ',' in /home/tester/public_html/test.ru/test.php on line 7

How to fix the error and what is it?

    2 answers 2

    Error in the 7th line. A comma there is completely out of topic.

    Nada so:

     if( $_POST['name'] == 'Vasya' ){ echo '<h1>Привет, хозяин!</h1>'; }else{ echo '<h1>Привет, <b>' . $_POST['name'] . '</b>!</h1>'; } 

      Yes, uzhzhzhzh ... Probably, it should still be like this (the commentator said about the comma correctly):

       <? if( isset($_POST['name']) and $_POST['name'] == 'Vasya' ): ?> <h1>Привет, хозяин!</h1> <? else: ?> <h1>Привет, <b><?= $_POST['name'] ?></b>!</h1> <? endif; ?>` 

      But I would create a new variable, assign it a value by a coaching operator and bring it in one place so as not to be confused.