D
D
Dmitry2016-09-04 13:52:58
PHP
Dmitry, 2016-09-04 13:52:58

How to save cookies?

There is a pop-up window that is constantly loaded when you open the page, you need to select a city in it
. How can I make the city that you selected from the pop-up window save in a cookie, and this window will not pop up again?
we have the following popup code:

<div class="container">
<div id="categories_list">
  <a href="#" id="current_cat">Выбрать город &#709;</a>
  <div id="categories_modal" style="display: none;">
      <div class="modal_title">
          <h5>Выберите ваш город</h5>
          <a href="#" class="close_btn">X</a>
      </div>
      <div class="modal_content">
        <ul class="row">
          <?php foreach($result["rows"] as $row) { ?>
<?php if ($row["name"]) { ?>
          <li class="col-md-6 col-xs-12"><a href="#cat<?php echo $row["id"]; ?>"><?php echo $row["name"]; ?></a></li>
          <?php } ?>
          <?php } ?>
        </ul>
      </div>
  </div>
</div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2016-09-04
@entermix

php.net/manual/en/features.cookies.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question