updating cookie php

  • Hello, everyone! There's a little violin for the record. cookieselect


        if (isset($_POST['year']) && isset($_POST['month'])){
            setcookie("year", "");
    setcookie("month", "");
    setcookie("year", $_POST['year']);
    setcookie("month", $_POST['month']);
         echo '<h1>'.$_COOKIE['year'].'<br>';
         echo $_COOKIE['month'].'</h1>'; 


    <form id="filter" method="post">
    <select name="month" style="margin-bottom:0px;">
    <option value="">Выберите месяц...</option>
    <option <?php if($_COOKIE['month']==1) echo 'selected="selected"';?> value="1">Январь</option>
    <option <?php if($_COOKIE['month']==2) echo 'selected="selected"';?> value="2">Февраль</option>
    <option <?php if($_COOKIE['month']==3) echo 'selected="selected"';?> value="3">Март</option>
    <option <?php if($_COOKIE['month']==4) echo 'selected="selected"';?> value="4">Апрель</option>
    <option <?php if($_COOKIE['month']==5) echo 'selected="selected"';?> value="5">Май</option>
    <option <?php if($_COOKIE['month']==6) echo 'selected="selected"';?> value="6">Июнь</option>
    <option <?php if($_COOKIE['month']==7) echo 'selected="selected"';?> value="7">Июль</option>
    <option <?php if($_COOKIE['month']==8) echo 'selected="selected"';?> value="8">Август</option>
    <option <?php if($_COOKIE['month']==9) echo 'selected="selected"';?> value="9">Сентябрь</option>
    <option <?php if($_COOKIE['month']==10) echo 'selected="selected"';?> value="10">Октябрь</option>
    <option <?php if($_COOKIE['month']==11) echo 'selected="selected"';?> value="11">Ноябрь</option>
    <option <?php if($_COOKIE['month']==12) echo 'selected="selected"';?> value="12">Декабрь</option>
    <select name="year" style="margin-bottom:0px;">
    <option value="">Выберите год...</option>
    <option value="2015" <?php if($_COOKIE['year']==2015) echo 'selected="selected"';?>>2015</option>
    <option value="2016" <?php if($_COOKIE['year']==2016) echo 'selected="selected"';?>>2016</option>
    <option value="2017" <?php if($_COOKIE['year']==2017) echo 'selected="selected"';?>>2017</option>
    <option value="2018" <?php if($_COOKIE['year']==2018) echo 'selected="selected"';?>>2018</option>
    <option value="2019" <?php if($_COOKIE['year']==2019) echo 'selected="selected"';?>>2019</option>
    <option value="2020" <?php if($_COOKIE['year']==2020) echo 'selected="selected"';?>>2020</option>
    <option value="2021" <?php if($_COOKIE['year']==2021) echo 'selected="selected"';?>>2021</option>

    <input type="submit" value="Вывести" name="vivod"></input>

    The thing is, the kitchens are recording, but here's the conclusion of a new cuisine, for example through. echo only after re-update. ♪ ♪

  • Yeah, that's how they work. When you put a pile on, she's going to the client. And only with his next request, he sends it to you and you see it in. $_COOKIE♪ Introduce your variable to which you will be put $_POSTIf it is, and if it's not there, it's a cucumber. And on this variable, do your own. if

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2