Código PHP:
    
<?php  
$dni = $_POST['dni'];
 
include('abre_conexion.php');   
    
    $query = "select * from $tabla_db1 where dni = '$dni'";
    $result = mysql_query($query);
    
$dni=$_REQUEST['dni'];  
$sql="SELECT dni FROM promocionmayo WHERE dni='$dni'";  
$res=mysql_query($sql);  
$total=mysql_num_rows($res);
 
if($total>0)  
{   
 
while ($registro = mysql_fetch_array($result)){ 
 
echo " 
<body> 
 
<section>
<p class='logo-promo'><img src='http://192.168.1.100/promomayo/logo-40-anios.jpg'></p>
<h1 class='titulo-promo'>7 DIAS DE COLOR Y VOLUMEN EN LUIS&TACHI CON L’ORÉAL PROFESSIONNEL</h1>
</section>
  
  <section id='main'>
      <article class='container roundedCorners highBottomShadowed'>
      
          <article class='header whiteBg'>
              <h3 class='title blackColor'>Introduce el DNI del usuario</h3>
              <form action='validar.php' method='POST'>
                  <input id='input' class='input' autocomplete='off' type='text' name='dni'><br/>
                  <input id='button' class='submit highRoundedCorners orangeBg whiteColor' type='submit' value='Comprobar' name='B1' />
              </form>
          </article>
 
        <article class='header whiteBgDark'> 
            <table border='0' id='table1'> 
                <tr> 
                    <td colspan='2'><h3 align='center'>Revise y actualice los datos si es preciso</h3></td> 
                </tr> 
                <tr> 
                    <td class='min-text' colspan='2'>Compruebe si el usuario ha usado la promoción. En caso negativo, proceda a registrarlo mediante la casilla de validación</td> 
                </tr> 
                <form method='POST' action='actualiza.php'> 
                <tr> 
                    <td width='50%'> </td> 
                    <td width='50%'> </td> 
                </tr> 
                <tr> 
                    <td width='50%'><p align='right'><b>Nombre: </b></td> 
                    <td width='50%'><p align='center'><input type='text' name='nombre' size='20' value='".$registro['nombre']."'></td> 
                </tr> 
                <tr> 
                    <td width='50%'><p align='right'><b>Apellido:</b></td> 
                    <td width='50%'><p align='center'><input type='text' name='apellido' size='20' value='".$registro['apellido']."'></td> 
                </tr> 
                <tr> 
                    <td width='50%'><p align='right'><b>DNI:</b></td> 
                    <td width='50%'><p align='center'><input type='text' name='dni' size='20' value='".$registro['dni']."'></td> 
                </tr>
                <tr> 
                    <td width='50%'><p align='right'><b>PREMIO:</b></td> 
                    <td width='50%'><p align='center'><input type='text' name='dni' size='20' value='".$registro['premio']."'></td> 
                </tr>
                <tr> 
                    <td width='50%'><p align='right'><b>SALÓN:</b></td> 
                    <td width='50%'><p align='center'><input type='text' name='dni' size='20' value='".$registro['salon']."'></td> 
                </tr>
                <tr> 
                    <td width='50%'><p align='right'><b>FECHA REDENCIÓN:</b></td> 
                    <td width='50%'><p align='center'><input type='text' name='dni' size='20' value='".$registro['fecha_redencion']."'></td> 
                </tr>
                <tr> 
                    <td width='50%'> </td> 
                    <td width='50%'> </td> 
                </tr> 
                <tr> 
                    <td width='100%' colspan='2'>
                        <p align='center'>
                            Este usuario <b>". ($registro['validar'] ? 'SI' : 'NO') ."</b> está registrado
                        </p>
                    </td> 
                </tr> 
                <tr> 
                    <td width='50%'> </td> 
                    <td width='50%'> </td> 
                </tr>
                
                ".if(($registro['validar'])==0){echo"
                <tr> 
                    <td width='50%'><p align='right'><b>Validar:</b></td>
                    <td width='50%'><p align='left'><input type='checkbox' name='validar' value='1'></td> 
                </tr>
 
                <tr> 
                    <td width='50%'> </td> 
                    <td width='50%'> </td> 
                </tr>                
                <input type='hidden' name='dni' value='$dni'> 
                <tr> 
                    <td width='100%' colspan='2'> 
                    <p align='center'> 
                    <input id='button' class='submit highRoundedCorners orangeBg whiteColor' type='submit' value='Registrar promoción' name='B1' />
                    </p></td>
                </tr>
                ";}."
                
                <tr> 
                    <td width='50%'> </td> 
                    <td width='50%'> </td> 
                </tr> 
                </form> 
            </table> 
        </article>
 
      </article>
  </section>
 
"; 
}
}  
else  
{  
  echo "
<body> 
 
<section>
<p class='logo-promo'><img src='http://192.168.1.100/promomayo/logo-40-anios.jpg'></p>
<h1 class='titulo-promo'>7 DIAS DE COLOR Y VOLUMEN EN LUIS&TACHI CON L’ORÉAL PROFESSIONNEL</h1>
</section>
  
  <section id='main'>
      <article class='container roundedCorners highBottomShadowed'>
      
          <article class='header whiteBg'>
              <h3 class='title blackColor'>Introduce el DNI del usuario</h3>
              <form action='validar.php' method='POST'>
                  <input id='input' class='input' autocomplete='off' type='text' name='dni'><br/>
                  <input id='button' class='submit highRoundedCorners orangeBg whiteColor' type='submit' value='Comprobar' name='B1' />
              </form>
          </article>
 
        <article class='header whiteBgDark'>
        <p class='max-text'>Este usuario NO está premiado</p>
        </article>
 
      </article>
  </section>
  
  ";  
}
 
include('cierra_conexion.php');   
?>