2
I have a grid of some hours notes that I have a filter pro user fills the date and loads my grid with the records and I have a <thead>
that has the days of the week, I am able to seek the right days, but it stays like this:
Segunda 12
Terça 13
Quarta 14
Quinta 15
Sexta 9
Sabado 10
Domingo 11
This picking up days from a previous week, but if I click on Thursday it orders correctly.
function diaSemana($variavel2, $dayName){
if($variavel2 != null){
$orderdate = explode('/', $variavel2);
$day = $orderdate[0];
$month = $orderdate[1];
$year = $orderdate[2];
$mes = date("m");
$ano = date("YYYY");
$dia = date("d");
$dia_semana = date("w");
$mes = $month;
$ano = $year;
$dia = $day;
}
$cont=0;
While($cont<=6)
{
$dia_calendario = date("d/m/Y",mktime(0,0,0,$mes,$dia-$dia_semana,$ano));
$dia_s_calendario = date("w",mktime(0,0,0,$mes,$dia-$dia_semana,$ano));
if($dayName == $dia_s_calendario ){
return $dia_calendario;
}
$dia_semana--;
$cont++;
}
}
<?php if(isset($_POST['variavel'])){?>
<thead>
<th id='thDomingo' class='trday'>DOMINGO<br><div id ='domingo' class='day' onclick='dataSemana(0)'><?php echo $dias = diaSemana($variavel2 = implode("/",array_reverse(explode("-",$_POST['variavel']))),0); ?></th>
<th id='thSegunda' class='trday'>SEGUNDA<br><div id ='segunda' class='day'onclick='dataSemana(1)'><?php echo $dias = diaSemana($variavel2 = implode("/",array_reverse(explode("-",$_POST['variavel']))),1); ?></div></th>
<th id='thTerca' class='trday'>TERÇA<br><div id ='terca' class='day' onclick='dataSemana(2)'><?php echo $dias = diaSemana($variavel2 = implode("/",array_reverse(explode("-",$_POST['variavel']))),2); ?></div></th>
<th id='thQuarta' class='trday'>QUARTA<br><div id ='quarta' class='day'onclick='dataSemana(3)'><?php echo $dias = diaSemana($variavel2 = implode("/",array_reverse(explode("-",$_POST['variavel']))),3); ?></div></th>
<th id='thQuinta' class='trday'>QUINTA<br><div id ='quinta' class='day' onclick='dataSemana(4)'><?php echo $dias = diaSemana($variavel2 = implode("/",array_reverse(explode("-",$_POST['variavel']))),4); ?></div></th>
<th id='thSexta' class='trday'>SEXTA<br><div id ='sexta' class='day' onclick='dataSemana(5)'><?php echo $dias = diaSemana($variavel2 = implode("/",array_reverse(explode("-",$_POST['variavel']))),5); ?></div></th>
<th id='thSabado' class='trday'>SÁBADO<br><div id ='sabado' class='day' onclick='dataSemana(6)'><?php echo $dias = diaSemana($variavel2 = implode("/",array_reverse(explode("-",$_POST['variavel']))),6); ?></div></th>
</thead>
<?php } ?>
What is the expected result? The days of the current week?
– Woss