J
J
JackShcherbakov2018-01-30 17:35:03
PHP
JackShcherbakov, 2018-01-30 17:35:03

Why does the interpreter swear at ?> in php?

There is a code:

<!DOCTYPE html>
    <html>

    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>Форма</title>
    </head>

    <body>

<?php
        if($_SERVER["REQUEST_METHOD"] == "POST"){
          process_form();	
        }
        else{
          show_form();
        }
  function show_form(){
  print <<<FORM_HTML
        <form method="POST" action="form.php">
          <input type="text" name="name" placeholder="Введите имя"><br>
          <select name="numbers[]" multiple>
            <option>1</option>
            <option>2</option>
            <option>3</option>
            <option>4</option>
            </select>
          <br>
          <input type="submit" value="Отправить">
        </form>
FORM_HTML;	
  }
  function process_form(){
          foreach ($_POST[numbers] as $value) {
            print $value . "<br>";
          }	
  }
?>		
</body>

</html>	//ЭТО СТРОКА 41

The interpreter writes this:
Parse error: syntax error, unexpected end of file in C:\OpenServer\domains\asd\form.php on line 41

Why is there a problem? How to fix? Saved in UTF-8 (without BOM)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick Sdk, 2018-01-30
@JackShcherbakov

at the end FORM_HTML; remove tabs :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question