Seria algo asi
Código PHP:
Ver original<?php
//registro.php
$errores = "";
if ($_POST) {
if ($_POST['usuario']) {
$errores = "Usuario obligatorio";
} else if ($_POST['nombre'])
$errores = "Usuario obligatorio";
} else {
// redirecciona a otro lado porque el form esta bien
header("Location: index.php"); }
}
?>
Código PHP:
Ver original<!-- formulario.php -->
<?php require_once 'registro.php'; ?>
<form method="post" action="formualrio.php">
<table>
<tr><th><?php echo @$errores; ?></th></tr>
<tr><td><input type="text" name="usuario" /></td></tr>
<tr><td><input type="text" name="nombre" /></td></tr>
</table>
</form>