Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/12/2016, 14:39
Avatar de bandolera
bandolera
 
Fecha de Ingreso: abril-2009
Mensajes: 613
Antigüedad: 15 años
Puntos: 7
Pregunta Respuesta: Definir variable

Cita:
Iniciado por Triby Ver Mensaje
Agrega la siguiente línea dentro de las funciones donde la necesites o, al inicio de un script php que sea incluido (include o require) dentro de una función.

Código PHP:
Ver original
  1. global $fecha_trabajo;
Le agregué global en el primero, luego recibe el $_POST[].
Código PHP:
<?php
global $fecha_trabajo;
$fecha_trabajo $_POST['fecha'];
$tpl = new Plantilla();
$tpl->display('plantilla.tpl.php');
?>
Muestra una plantilla y llamada a otro PHP.
Código HTML:
<!DOCTYPE html>
<html lang="es">
<head>
</head>
<body>
<form name="cambio_nombre" action="index.php?action=mostrar.php" method="POST" enctype="multipart/form-data">
</form>
</body>
</html> 
Y en este PHP solo quiero mostrar la misma variable pero sale
Código:
Undefined variable:
Código PHP:
<?php
echo $fecha_trabajo;
?>
__________________
Todos somos iguales. NO! a la violencia de género.