Hello! I'm just starting to learn PHP help solve the problem)
On the village there is an input field in it, I have to write a key from the previously created array, and when I send it I should return the value of this key.
Here is an array:
$data = array( "Привет" => "Хай!", "Как дела?" => "Отлично!", ) Here is the form:
require 'data.php'; // Подключаем массив $name = htmlspecialchars($_POST["text"]); $respond = "Error!"; if (($_POST["text"]) == "Сюда получаем ключ из input") { echo "Сюда приходит значение введенного ключа из массива"; } else { echo "$respond"; } <form method="post" action=""> <input type="text" name="text" id="text" placeholder="key"> <button type="submit">Send</button> </form> Maybe you have your options, how can this be implemented?