Ver Mensaje Individual
  #6 (permalink)  
Antiguo 14/06/2012, 14:35
Avatar de linuxzero
linuxzero
 
Fecha de Ingreso: noviembre-2011
Ubicación: Argentina
Mensajes: 778
Antigüedad: 12 años, 5 meses
Puntos: 160
Respuesta: Mostrar valor de una funcion!

Seria algo asi

Código PHP:
Ver original
  1. <?php
  2. //registro.php
  3. $errores = "";
  4. if ($_POST) {
  5.     if ($_POST['usuario']) {
  6.         $errores = "Usuario obligatorio";
  7.     } else if ($_POST['nombre'])
  8.         $errores = "Usuario obligatorio";
  9.     } else {
  10.         // redirecciona a otro lado porque el form esta bien
  11.         header("Location: index.php");
  12.     }
  13. }
  14. ?>

Código PHP:
Ver original
  1. <!-- formulario.php -->
  2. <?php require_once 'registro.php'; ?>
  3. <form method="post" action="formualrio.php">
  4.     <table>
  5.         <tr><th><?php echo @$errores; ?></th></tr>
  6.         <tr><td><input type="text" name="usuario" /></td></tr>
  7.         <tr><td><input type="text" name="nombre" /></td></tr>
  8.     </table>
  9. </form>
__________________
Si todo fuera tan sencillo como un symfony cc la vida seria más fácil.
http://phpnico.wordpress.com