Untitled
unknown
php
3 years ago
978 B
8
Indexable
<?php
$name = $_POST['feedback-name'];
$phone = $_POST['feedback-phone'];
$question = $_POST['feedback-question'];
$mail = $_POST['feedback-mail'];
if (isset($mail)) {
$arr = array(
'Имя пользователя: ' => $name,
'Телефон: ' => $phone,
'Почта: ' => $mail,
);
} else {
$arr = array(
'Имя пользователя: ' => $name,
'Телефон: ' => $phone,
'Вопрос: ' => $question,
);
}
// $arr = array(
// 'Имя пользователя: ' => $name,
// 'Телефон: ' => $phone,
// 'Вопрос: ' => $question,
// );
$txt = '';
foreach ($arr as $key => $value) {
$txt .= "<b>" . $key . "</b> " . $value . "%0A";
};
$sendToTelegram = fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}", "r");
if ($sendToTelegram) {
echo file_get_contents("./thank-en.php");
} else {
echo "Error";
}Editor is loading...