title: the selected days between 2 dates as a weekly cycle in php
body: <pre><code>$startdate = strtotime($_POST[startdate]);
  
  $enddate = strtotime($_POST[enddate]);
  
  if (!empty($_POST[startdate]))
  
  {
  
  $fmonday = strtotime(&quot;last monday&quot;, strtotime($_POST[startdate])); 
  
  $txtDays = $_POST[txtDay]; 
  //from checked boxes checked dates  values &quot;+ 1 day&quot;, &quot;+2 day&quot;, ...
  
  foreach($txtDays as $txtDay)
  {
  $txtGetDate =  strtotime($txtDay, $fmonday);
  if ($txtGetDate  &gt;=  $startdate)
  {
  echo date(&quot;d-m-Y&quot;, $txtGetDate).&quot;&lt;br&gt;&quot;;
  echo date(&quot;d-m-Y&quot;,strtotime(&quot;+1 week&quot;, $txtGetDate)).&quot;dddd&lt;br&gt;&quot;;
  }
  }
  }
  //-------------------------
  </code></pre>
  <p>I have problem with weekly cycle. I need listed of selected dates in a range but weekly cycle.<br>
  For example;<br></p>
  <p>I selected Mon And Fri in a week; but its variable; sometimes just 1 day sometimes 5 days. This dates in a range between stardate and enddate.
  I need listed of date look like as below <br></p>
  <p>01.01.2020 Mon<br>
  05.01.2020 Fri<br>
  08.01.2020 Mon<br>
  12.01.2020 Fri<br>
  15.01.2020 Mon<br>
  19.01.2020 Fri<br></p>
  <pre class="lang-html prettyprint-override"><code>&lt;form action=&quot;&quot; method=&quot;POST&quot;&gt;
  &lt;tr&gt;&lt;td style=&quot;width:15%;&quot;&gt;Dönem Başlangıç&lt;/td&gt;
  &lt;td style=&quot;width:15%;&quot;&gt;
  &lt;input type=&quot;text&quot; name=&quot;startdate&quot; style=&quot;width:95%;height:20px;text-align:center;&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;width:15%;&quot;&gt;Dönem Bitiş&lt;/td&gt;
  &lt;td style=&quot;width:15%;&quot;&gt;
  &lt;input type=&quot;text&quot; name=&quot;enddate&quot; style=&quot;width:95%;height:20px;text-align:center;&quot;&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;tr&gt;
  &lt;td&gt;&lt;input type=&quot;checkbox&quot; class=&quot;deneme&quot; name=&quot;txtSali[]&quot; value=&quot;&lt;?php echo date( 'Y-m-d', strtotime( 'monday this week' ))?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;checkbox&quot; class=&quot;deneme&quot; name=&quot;txtSali[]&quot; value=&quot;&lt;?php echo date( 'Y-m-d', strtotime( 'tuesday this week' ))?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;checkbox&quot; class=&quot;deneme&quot; name=&quot;txtSali[]&quot; value=&quot;&lt;?php echo date( 'Y-m-d', strtotime( 'wednesday this week' ))?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;cheackbox&quot; class=&quot;deneme&quot; name=&quot;txtSali[]&quot; value=&quot;&lt;?php echo date( 'Y-m-d', strtotime( 'thursday this week' ))?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;checkbox&quot; class=&quot;deneme&quot; name=&quot;txtSali[]&quot; value=&quot;&lt;?php echo date( 'Y-m-d', strtotime( 'friday this week' ))?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;checkbox&quot; class=&quot;deneme&quot; name=&quot;txtSali[]&quot; value=&quot;&lt;?php echo date( 'Y-m-d', strtotime( 'saturday this week' ))?&gt;&quot;&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type=&quot;checkbox&quot; class=&quot;deneme&quot; name=&quot;txtSali[]&quot; value=&quot;&lt;?php echo date( 'Y-m-d', strtotime( 'sunday this week' ))?&gt;&quot;&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>