Issue message by pressing submit button and display access result to bb.dd

1

We have a page with HTLM and php code with include (Busconv.php), in which I perform a search on bb.ddd, I would like to know how I can issue a message when I press the SEARCH button and there is no record in the bb.dd ..

The approach is:

When accessing the page 2 Select are loaded with the contents of two tables of the bb.dd and nothing else. and not of any message as to whether or not it exists in the search for information.

Next, select both and perform a search.

If there is data, it issues message 0-DATOS CORRECTOS DE LA INSCRIPCION DE ESTE SOCIO and shows them, this is correct.

But if they do not exist, it does NOT issue the 3-NO EXISTE INSCRIPCION DE ESTE SOCIO message and I only want to show it when it is accessed and the result is that.

I have solved the problem that when I just open the page I do not get the message.

And what I would like is for the message to come out when I press the button and there is no data.

I inform you of the code:

<html>
<script language="JavaScript"> 
function pregunta(){ 
    if (confirm('Los datos serán guardados en la Base de Datos de SXXXX. ¿Estás seguro de realizar esta acción?')){ 
       document.Actualizar.submit() 
    } 
} 
</script> 
<body>
<h2 style="text-align: center; text-none: 6px 8px 10px #00FF00; text-decoration: underline; color: blue; font-size: 18pt; font-family: tahoma;"><b>MANTENIMIENTO DATOS INSCRIPCIONES</b> </h2>                                                            
<div  class="form-inline"> </body>
<form action=" " method="POST"> 
<?php
include("conexion.php");
if ($con->connect_error) {
    die("Error de Conexion/Fallida: " . $con->connect_error);
} 

$Var1='N';
$codigo_ruta=$_POST['numconv'];
$tildes = $con->query("SET NAMES 'utf8'"); 
$sqlSocios = mysqli_query($con,"SELECT * FROM Maesocios where situac ='A'
                                      ORDER BY nombre ");                                                                                                                                                    
mysqli_data_seek ($sqlSocios, 0);  

$sqlRutas = mysqli_query($con,"SELECT * FROM Rutas
                                      ORDER BY fecha_programa desc");                                                                                                                                                    
mysqli_data_seek ($sqlRutas, 0);  ?>
<span style="color: red;" style="color: red;"> <strong> DNI SOCIO: <select name="dni"  style="width:300px" SIZE="0" autofocus> 
           <option value="">  Seleccionar  </option>" 
           <?
            while ($row = mysqli_fetch_array($sqlSocios)) {
             if(isset($_POST["dni"]) && $_POST["dni"]==$row['dni'])
              echo "<option value='".$row['dni']."'  selected >".$row['dni']." ".$row['nombre']." - ".$row['ape1']."</option>"; 
        else
            echo "<option value=".$row['dni'].">".$row['dni']." ".$row['nombre']." - ".$row['ape1']."</ - ".$row['ape1']."</option>"; } ?>?>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</select> <span style="color: red;" style="color: red;"> <strong>CONVOCATORIA: <select name="numconv"  style="width:250px" SIZE="0" autofocus> 
     <option value="">  Seleccionar  </option>" 
<?
  while ($row = mysqli_fetch_array($sqlRutas)) {
            if(isset($_POST["numconv"]) && $_POST["numconv"]==$row['codigo_ruta']) 
               echo "<option value='".$row['codigo_ruta']."'  selected >".$row['codigo_ruta']." ".$row['descripcion']."</option>";
            else
           echo "<option value=".$row['codigo_ruta'].">".$row['codigo_ruta']." ".$row['descripcion']."</option>"; } ?></select>&nbsp; &nbsp; &nbsp; &nbsp; <input type="submit" name="enviar" value="BUSCAR" onclick= <?php include("BusConvo.php"); ?> >

<?php     if ($row = mysqli_fetch_array($result))
       {echo "<script> alert('0-DATOS CORRECTOS DE LA INSCRIPCION DE ESTE SOCIO');</script>";$Var1='S';} 
    else
       {if("$Var1"=='S')
             {;echo "<script> alert('3-NO EXISTE INSCRIPCION DE ESTE SOCIO');</script>";}
         else
             {$Var1='S';}
       }?>

</form>         
    
asked by Econed 16.05.2018 в 11:40
source

0 answers