Onclick PHP or JavaScript

0

I explain my problem. I'm doing a kind of calendar with which to click on a day, within the same page opens the selected day, telling me if it is Monday, Tuesday ... the day in number and the year of the day I have selected.

Now I was trying to do > and < so that when I clicked I changed the day to one more or one less. In the monthly calendar I also have it but that I did with JavaScript, now I was doing the diary with PHP, because when I received the AJAX call, I received it with $ _POST and it was easier for me. But when I get to this point, I think I can not do that with PHP, and I wanted to ask you if there is any way to do it or I have to do it all with JavaScript again. I leave the PHP code that I have for now so you can take a look:

<?php
if (strpos(getcwd(), 'apen_files') !== false) {
	define('_PS_ADMIN_DIR_', getcwd());
} else {
	define('_PS_ADMIN_DIR_', getcwd().'/includes/apen_files/');
}
 require (_PS_ADMIN_DIR_."/config.php"); 
 
 //-----------------------------------------------------
 $any = $_POST['id_anio']; 
 $mesac=date ("F");
 $diaac=date ("j"); 
$mes = isset($_POST['id_mes'])? $_POST['id_mes'] : null;
$nomdia=date ("l");
$dia = $_POST['id_day'];
$date= "".$dia."-".$mes."-".$any;
$undiamas = $dia +1;
$undiamenos = $dia -1;
$unmesmas = $mes +1;
$unmesmenos = $mes -1;
$primerdiames = date('m-1-Y');
$ultim = date('t');

 ?>
<link rel="stylesheet" type="text/css" href="../../css/estilo.css"/>
<div id="principal_pordias">
	
</div>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<?php $meses = array('',"ENERO", "FEBRERO", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPTIEMBRE", "OCTUBRE", "NOVIEMBRE", "DICIEMBRE"); ?>
<?php $mesesing = array('',"January", "Febrary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); ?>
<?php $dias = array('', 'LUNES','MARTES','MIÉRCOLES','JUEVES','VIERNES','SÁBADO', 'DOMINGO'); ?>
<?php function saber_dia($date) {
$dias = array('', 'LUNES','MARTES','MIÉRCOLES','JUEVES','VIERNES','SÁBADO', 'DOMINGO');
$fecha = $dias[date('N', strtotime($date))];
echo $fecha;
} ?>
<p>
<div><center>
<?php echo $any; ?>
</center></div>
<p>
<div><center>
<?php
if ($mes && !empty($mes)) {
    echo $meses[$mes];
}
else {
	echo $meses[date('n')];
}
?>
</center></div>
<p>
<div id="dias"><center>
<?php
if ($dia && !empty($dia))
{	echo $dia; }
else {
	echo $diaac;
}
	?>
</center></div>
<div><a onclick="$dia +1">&lt;</a></div> <div><a onclick='mostrarCalendario("+nextYear+","+nextMonth+")'>&gt;</a></div>
</script>
<p>
<div><center>
<?php
if ($dia && !empty($dia)) {
saber_dia($date); }
else {
	echo $dias[date('w')];
}
?>

<?php
$sinmes = $mesesing[date('n')];
$ultimodiamesant = date('t', strtotime($sinmes , '2018'));
 echo $ultimodiamesant; ?>

    <div id="fecha"></div>
</body>

</html> 

Thank you very much for your help, the truth is that I was a bit confused when I got to this point.

    
asked by Joume Parra 21.06.2018 в 20:16
source

0 answers