Answer the question
In order to leave comments, you need to log in
How to use a variable from another modx revo snippet in a snippet?
I have an array stored in one snippet A. I need to get values from it in another snippet. Q. How can I do this? Relatively speaking, include snippet A to snippet B?
//тут подключение к бд
if(!empty($_POST["referal"])){ //Принимаем данные
$referal = trim(strip_tags(stripcslashes(htmlspecialchars($_POST["referal"]))));
$db_referal = $mysqli -> query("SELECT * FROM `geo_city`".PREFIX."search WHERE name LIKE '%$referal%'")
or die('Ошибка №'.__LINE__);
while ($row = $db_referal -> fetch_array()) {
echo "\n<li>".$row["name"]."</li>"; //$row["name"] - имя таблицы
}
}
Answer the question
In order to leave comments, you need to log in
https://docs.modx.com/current/en/extending-modx/mo...
Call another snippet from the snippet, passing the required parameters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question