forked from obetancourthunicah/IF412NegociosWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathej5.php
54 lines (48 loc) · 1.18 KB
/
ej5.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
session_start();
$_SESSION["username"]="Usuario";
$contenidoSession ="";
function agregarSession($dato){
return "AS Contenido: " . $dato;
}
function eliminarDeSession($dato){
return "ES Contenido: ". $dato;
}
if(!isset($_SESSION["click"])){
$_SESSION["click"] = 0;
}
if(isset($_POST["btnAdd"])){
$contenidoSession .= agregarSession($_POST["txtData"]);
$_SESSION["click"] ++;
}
if(isset($_POST["btnSubs"])){
$contenidoSession = eliminarDeSession($_POST["txtData"]);
$_SESSION["click"] ++;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Funciones y SESSION</title>
</head>
<body>
<h1>Funciones y el Arreglo SESSION</h1>
<form action="ej5.php" method="POST">
<label for="txtData">Data</label>
<input type="text" id="txtData"
name="txtData" />
<br/>
<input type="submit" name="btnAdd"
id="btnAdd" value="Agregar a la Sesión" />
<input type="submit" name="btnSubs"
id="btnSubs"
value="Eliminar de la Sesión" />
</form>
<div>
<?php
echo $contenidoSession;
?>
</div>
</body>
</html>