Last active
November 22, 2015 16:53
-
-
Save sebastopolys/e67d75d72cb78d2ff1ae to your computer and use it in GitHub Desktop.
Control de calendario para pasar de un mes a otro..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<?php | |
$actual = date("m"); //11 | |
$ini=$_POST['ini']; | |
if (!isset($_POST['ms']) && !isset($_POST['ma']) && !isset($_POST['mp'])) | |
{ | |
echo 'el mes es:'.$actual; | |
} | |
else{ | |
if (isset($_POST['ms'])) | |
{ | |
echo 'el mes sigue siendo'.$actual; | |
$ini=$actual; | |
} | |
elseif (isset($_POST['ma'])) | |
{ | |
$ini--; | |
echo 'el mes ahora es'. $ini; | |
} | |
elseif (isset($_POST['mp'])) | |
{ | |
$ini++; | |
echo 'el mes ahora es'. $ini; | |
} | |
else {echo 'nada';} | |
} | |
?> | |
<div> | |
<!-- | |
Linea 37: si el formulario no se ha enviado $_POST['ini'] es 11. | |
Línea 39: si ya se envió, $_POST['ini'] es el nuevo valor de $ini. | |
--> | |
<form method="post" action="prueba_counter.php" id="counter" name="counter" > | |
<?php if(empty($_POST)){ ?> | |
<input type="hidden" value='<?php echo $actual; ?>' name="ini"/> | |
<?php } else{ ?> | |
<input type="hidden" value='<?php echo $ini; ?>' name="ini"/> | |
<?php } ?> | |
<table> | |
<tr> | |
<td><input type="submit" value='Anterior' id="ma" name="ma"/></td> | |
<td><input type="submit" value='Mes actual' id="ms" name="ms"/></td> | |
<td><input type="submit" value='Proximo' id="mp" name="mp"/></td> | |
</tr> | |
</table> | |
</form> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment