M
M
modxyou2018-02-23 11:37:34
MODX
modxyou, 2018-02-23 11:37:34

How to correctly read the value from cookies and assign a name to this value?

Good afternoon!
The cookie contains the city number. Written via Java.
Tell me, how to display the city in accordance with the number on the site through the snippet in php (modx)?
Created this design:

<?php
// выводим куку с именем "city"
if ( $_COOKIE['city'] != '1' )
  echo 'Абакан';
if ( $_COOKIE['city'] != '2' )
  echo 'Москва';
else 
  echo 'Привет, Гость!';

For some reason, it brings Moscow to the first city. And on the second one, there are generally two values ​​.... in general, somehow it doesn’t work correctly.
Tell me how to make the correct design?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question