M
M
Maxim Shchirba2020-05-07 17:48:51
PHP
Maxim Shchirba, 2020-05-07 17:48:51

Why does the "unexpected end of file" error occur?

Mistake:

Parse error: syntax error, unexpected end of file in /storage/ssd3/670/13599670/public_html/form.php on line 19

The code:

<?php
 /* Здесь проверяется существование переменных */
  if (isset($_POST['phone'])) {$phone = $_POST['phone'];}
 if (isset($_POST['name'])) {$name = $_POST['name'];}
 
/* Сюда впишите свою эл. почту */
 $address = "[email protected]";
/* А здесь прописывается текст сообщения, \n - перенос строки */
 $mes = "Тема: Заказ обратного звонка!\nТелефон: $phone\nИмя: $name\";
/* А эта функция как раз занимается отправкой письма на указанный вами email */
$sub='Заказ'; //сабж
$email='Заказ доска 3 в 1'; // от кого
 $send = mail ($address,$sub,$mes,"Content-type:text/plain charset = utf-8\r\nFrom:$email");
 
ini_set('short_open_tag', 'On');
header('Refresh: 3; URL=index.html');
?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
edward_freedom, 2020-05-07
@caest

Install for example phpstorm and there the error will immediately appear. In your case, you escaped the quote\"

S
SagePtr, 2020-05-07
@SagePtr

Open your code in any editor with syntax highlighting, and immediately notice where the line is not closed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question