The button is not working for me, but it does not work for me. It does not do any action. I see the code and it does not lack anything. plssss ...: CC

-2
<? 
include('index2.php');
?>
<script src="jquery.js" type="text/javascript"></script>   
<script src="jquery-3.1.1.min.js" type="text/javascript"></script> 
<script type="text/javascript" src="functions.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $("#marca").change(function(){
    $.ajax({
      url:"subcategorias2.php",
      type: "POST",
      data:"idmarca="+$("#marca").val(),
      success: function(opciones){
        $("#modelo").html(opciones);
      }
    })
  });
});
</script>
<br/>
<center><div style="width:60%;"><h4 style="COLOR: #0404B4; BACKGROUND-COLOR: #D0FA58; opacity: 0.8">Ver Aviso Auditado</h4></div></center><br/>
<br/>

<?
$id_p = $_GET["id_p"];
$path2="/CARPETA/CARPETAv2_$id_p"; 




function leerDirectorio($ruta){
if($dir = opendir($ruta)){ 
chdir($ruta);
//Creamos los array de archivos y carpetas 
$archivos=array();
$carpetas=array();
//Leemos todos los elementos del directorio 
while (($leerDir = readdir($dir)) !== false){
  if(!is_dir ($leerDir)) array_push($archivos,$leerDir);
    else array_push($carpetas,$leerDir);
    }
  //Mostrar Archivos 

  foreach($archivos as $aux) 
    {
    ?>

    <a href='../BBDD/CARPETA/preventivo<?=$_GET["id_p"]?>/Preventivo_<?=$aux?>'><?=$aux?></a><br /><?}?>      
    <?
    /* Cerrar directorio */
    closedir($dir);
    } 
}

function leerDirectorioTermino($ruta){
if($dir = opendir($ruta)){ 
chdir($ruta);
//Creamos los array de archivos y carpetas 
$archivos=array();
$carpetas=array();
//Leemos todos los elementos del directorio 
while (($leerDir = readdir($dir)) !== false){
  if(!is_dir ($leerDir)) array_push($archivos,$leerDir);
    else array_push($carpetas,$leerDir);
    }
  //Mostrar Archivos 

  foreach($archivos as $aux) 
    {
    ?>

    <a href='../BBDD/CARPETA/folio_termino_<?=$_GET["id_p"]?>/<?=$aux?>'><?=$aux?></a><br /><?}?>      
    <?
    /* Cerrar directorio */
    closedir($dir);
    } 
}




$link = mysqli_connect("localhost","pcomp","KneTPuxJ77f4YLNX", "BBDD");
$sql123 = "SELECT * , TIME_TO_SEC( TIMEDIFF( NOW( ) ,  'fecha_ingreso' ) ) /3600 AS horas_sla
FROM avisos_auditados where id_aviso = $id_p";
$result123 = mysql_query($sql123);
while ($row = mysql_fetch_array($result123)) {

  $area = $row["area_derivacion"];
?>
    <table align="center" class="table" style="width: 50%" >
<tr>
<td>Adjuntos de inicio</td>
<td><? echo @leerDirectorio($path2) ?></td>
</tr>

<tr>
<td>Adjuntos de termino</td>
<td><? echo @leerDirectorioTermino($path3) ?></td>
</tr>

</table><br/> 

   <center><table id="tablabonita" class="table" align="center" style="width: auto">
  <tr>
  <?
$tipo_defecto = $row["tipo_defecto"];
$agencia = $row["agencia"];
$central = $row["central"];
$direccion = $row["direccion"];
$tipo_cable = $row["tipo_cable"];
$cable = $row["cable"];
$arCARPETA = $row["arCARPETA"];
$causa_falla = $row["causa_falla"];


  ?>
                <td>
                    ID Aviso</td>
                <td>
                   <input id="txtID_proy"  style="width:350px;" type="text" readonly="readonly" 
                        value="<?php echo $row["id_aviso"]; ?>" >
                </td>
            </tr>
            <tr>
            <td>
                    tipo_defecto</td>
                <td>
                   <input id="txtcalle0" style="width:350px;"  type="text" readonly="readonly" 
                        value="<?php echo utf8_encode($row["tipo_defecto"]); ?>" >
                </td>
            </tr>
            <tr>
                <td>
                    Agencia
                </td>
                <td>
                  <input id="txtaltura0" style="width:350px;"  type="text" value="<?php echo utf8_encode($row["agencia"]); ?>" ></td>
            </tr>
            <tr>
                <td>
                    Oficina Central
                </td>
                <td>
                 <input id="txthp0" type="text" style="width:350px;"  readonly="readonly" 
                        value="<?php echo $row["central"]; ?>" ></td>
            </tr>

            <tr>
                <td>
                    Direccion                </td>
                <td>
                    <input id="txtcap0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo $row["direccion"]; ?>" ></td>
            </tr>
            <tr>
                <td>
                    Tipo Cable
                </td>
                <td>
                    <input id="txteecc0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["tipo_cable"]); ?>" ></td>
            </tr>
      <tr>
                <td>
                    Cable
                </td>
                <td>
                    <input id="txteecc0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["cable"]); ?>" ></td>
            </tr>
            <tr>
                <td>
                    ArCARPETA
                </td>
                <td>
                    <input id="txteecc0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["arCARPETA"]); ?>" ></td>
            </tr>
      <tr>
                <td>
                    Causa Falla
                </td>
                <td>
                    <input id="txteecc0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["causa_falla"]); ?>" ></td>
            </tr>
      <tr>
                <td>
                    Fecha Ingreso
                </td>
                <td>
                    <input id="txteecc0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["fecha_ingreso"]); ?>" ></td>
            </tr>
      <tr>
                <td>
                    Usuario Ingreso aviso
                </td>
                <td>
                    <input id="txteecc0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["usuario_ingreso_aviso"]); ?>" ></td>
            </tr>
      <tr>
                <td>
                 N° Reclamos               </td>
                <td>
                    <input id="txteecc0" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["n_clientes_reclamados"]); ?>" ></td>
            </tr>
            <tr>
                <td>
                 Estado               </td>
                <td>
                    <input id="txtEstado" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["estado"]); ?>" ></td>
            </tr>
            <tr>
                <td>
                 Nombre Gestor               </td>
                <td>
                    <input id="txtNGestor" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["nom_gestor"]); ?>" ></td>
            </tr>
            <tr>
                <td>
                 Tipo De Ruta              </td>
                <td>
                    <input id="txtTRuta" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["tipo_ruta"]); ?>" ></td>
            </tr>
            <tr>
                <td>
                 Clientes Afectados               </td>
                <td>
                    <input id="txtCAfectado" style="width:350px;"  readonly="readonly" type="text" 
                        value="<?php echo utf8_encode($row["n_clientes_afectados"]); ?>" ></td>
            </tr>
      <tr>

</table></center><?
$tipo_cble = $row["tipo_cable"];
}?>

<script lenguaje="javascript">
function AprobadoOK(form)
{ 
document.getElementById('div_es_falla').style.display = 'block';
}
function Rechazo(form)
{ 
document.getElementById('div_es_falla').style.display = 'none';
}
</script>
<center><h3>Asignación de trabajo</h3>

<fieldset width="700px">
        <legend><center>Seleccione: </center></legend>
        <label>
            <input type="radio" name="estado" id="Rechazado" onClick="Rechazo(this.form)" value="Rechazado"> No es Falla Masiva
        </label>
    <label>
            <input type="radio" name="estado" id="Aprobado" checked value="Aprobado" onClick="AprobadoOK(this.form)"> Es Falla Masiva
        </label>
 </fieldset></div>
  <br/>
    <div id="div_es_falla">
  <table style="width: 50%;" align="center"><tr>
     <td>
                    Causa de falla </td>
                <td>  <select id="tipo" name="tipo" class="form-control">
                       <option value="Robo">Robo</option>
                       <option value="Readecuacion">Readecuacion</option>
                       <option value="Transferencia">Transferencia</option>
                       <option value="Mantencion">Mantencion</option>
                       <option value="Danos por terceros">Daños por terceros</option>

            </select></td>
            </tr>
   <tr>
              <td>
                    Capacidad Cable </td>
               <td>
                    <input id="capacidad" class="form-control" name="capacidad" type="text" /></td><td><i>El valor de capacidad ingresado <b>debe ser numérico</b></i></td>
            </tr>

      <tr>
              <td>
                    Cuenta 1 </td>
               <td>
                    <input id="c1" name="c1" type="text" class="form-control" disabled="disabled" /></td><td>
                     Ingresar   
    <input type="checkbox" name="chec1"  value="checkbox" onclick="document.getElementById('c1').disabled=!this.checked;">  </td>
            </tr>

      <tr>
              <td>
                    Cuenta 2 </td>
               <td>
                    <input id="c2" name="c2" type="text" class="form-control" disabled="disabled"/></td><td>
                     Ingresar   
    <input type="checkbox" name="chec2" value="checkbox"  onclick="document.getElementById('c2').disabled=!this.checked;">  </td>
            </tr>
      <tr>
              <td>
                    Cuenta 3 </td>
               <td>
                    <input id="c3" name="c3" type="text" class="form-control" disabled="disabled"/></td><td>
                     Ingresar   
    <input type="checkbox" name="chec3" value="checkbox"  onclick="document.getElementById('c3').disabled=!this.checked;">  </td>
            </tr>
      <tr>
              <td>
                    Cuenta 4 </td>
               <td>
                    <input id="c4" name="c4" type="text" class="form-control" disabled="disabled"/></td><td>
                     Ingresar   
    <input type="checkbox" name="chec4" value="checkbox" onclick="document.getElementById('c4').disabled=!this.checked;">  </td>
            </tr>
      <tr>
              <td>
                    Cuenta 5 </td>
               <td>
                    <input id="c5" name="c5" type="text"  class="form-control" disabled="disabled"/></br></td><td>
                     Ingresar   
    <input type="checkbox" name="chec5" value="checkbox" onclick="document.getElementById('c5').disabled=!this.checked;">  </td>
            </tr>
      </table>  
  </div>
  <table align="center" style="width: 50%;" >

            <tr>
               <td>
                     Par:
               </td>
               <td>
                     <select id="par" name="par" class="form-control">
                            <option value="Par Local">Par Local</option>
                            <option value="Par Externo">Par Externo</option>
                     </select>
               </td>
           </tr>

         <tr>
                <td>
                    Comentarios: </td>
                <td>
                    <textarea rows="4" class="form-control" cols="50" id="obs" name="obs"></textarea></td>
            </tr>
</table>
    <br/>

        <div align="center">
                <input align="center" name="EnviarInfo" class="btn btn-primary btn-block"  type="submit" style="width: 50%"  value="asignar">
        </div>
  </center>

    <?
if ($_POST[EnviarInfo])
{
   $causa_falla = $_POST['causa_falla'];
      $link = mysqli_connect("localhost","pcomp","KneTPuxJ77f4YLNX", "BBDD");
      $causa = $_POST['tipo'];
      $direccion = $_POST['direccion'];
      $capacidad = $_POST['capacidad'];
      $tipo_cable = $_POST['tipo_cable'];

      $c1 = $_POST['c1'];
      $c2 = $_POST['c2'];
      $c3 = $_POST['c3'];
      $c4 = $_POST['c4'];
      $c5 = $_POST['c5'];
      $date = date('Y-m-d H:i:s');
      $obs = $_POST['obs'];
      $par = $_POST['par'];

  if ($_POST['estado'] == 'Rechazado'){
        $sql = "UPDATE avisos set estado='Rechazado',  fecha_respuesta_aviso='$date', fecha_cierre='$date'
        , par = '$par' , direccion='$direccion',causa_falla='$causa_falla' tipo_cable= '$tipo_cable' $obs='obs' where id_aviso=$id_p";

        $sql2 = "INSERT INTO historico (id_aviso, fecha, estado, usuario, observaciones) values ('$id_p','$date', 'Rechazado', '$aux', '$obs')";

    $sql4 = "INSERT INTO messageTest (notification, status, Fecha, Relevancia, Id_aviso, nivel_usuario, prueba) values ('El aviso $id_p ha sido localizado y se cierra por no ser falla de planta externa.','unread','$date', 'Urgente', '$id_p', '5', '$aux')";

    if(mysqli_query($link, $sql) and mysqli_query($link, $sql2) and mysqli_query($link, $sql4)){

                echo "<script>alert('Cambios realizados', 'asignar FALLA')</script>"; 

            } else{

                echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
            }

              $yourURL="editar_auditado_id.php?id=$aux";
              //echo ("<script>location.href='$yourURL'</script>");
            echo"<META HTTP-EQUIV='Refresh' CONTENT='0;url=$yourURL'/>"; 



    }
    else if ($_POST['estado'] == 'Aprobado'){

        if ($c1 == " " && $c2 == " " && $c3 == " " && $c4 == " " && $c5 == " " ) {

            echo "<script>alert('Debe ingresar una cuenta como minimo', 'Debe ingresar una cuenta')</script>";

        }else {

            $contadorCuentas = 0;

            if ($c1 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c2 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c3 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c4 == "  " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c5 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }


            $sql = "UPDATE avisos_auditados set estado='Aprobado', fecha_respuesta_aviso='$date', cuenta1='$c1', cuenta2='$c2',cuenta3='$c3',cuenta4='$c4',cuenta5='$c5', capacidad='$capacidad', causa_falla='$causa_falla',Causa='$tipo',  par = '$par', direccion = '$direccion', tipo_cable='$tipo_cable' where id_aviso=$id_p";

            $sql2 = "INSERT INTO historico (id_aviso, fecha, estado, usuario, observaciones) 
                     VALUES ('$id_p','$date', 'Aprobado FALLA', '$aux', '$obs')";

            $sql4 = "INSERT INTO messageTest (notification, status, Fecha, Relevancia, Id_aviso, nivel_usuario, prueba, estado_aviso) 
                     VALUES ('El Aviso $id_p ha sido verificado y se encuentra en estado de Aprobado  ','unread','$date', 'Urgente', '$id_p', '5', '$aux', 'Aprobado FALLA')";


            if(mysqli_query($link, $sql) and mysqli_query($link, $sql2) and mysqli_query($link, $sql4)){

                echo "<script>alert('Cambios realizados', 'asignar FALLA')</script>"; 

            } else{

                echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
            }

              $yourURL="editar_auditado_id?id=$aux";
              //echo ("<script>location.href='$yourURL'</script>");
            echo"<META HTTP-EQUIV='Refresh' CONTENT='0;url=$yourURL'/>"; 

            }

    }


}

$sql_aux_aux = "SELECT * FROM  'historico' where id_aviso = $id_p";
echo '<div class="container">
      <div class="table-responsive">';
echo '<h4 align="left">Historico</h4>';
echo'<br/><center>';

        echo'<table  id="tablabonita" class="table">';
        echo'<th> ID Fecha</th><th> Estado </th><th> Usuario </th><th> Observaciones </th>';
        $result_aux = mysql_query($sql_aux_aux);
     while ($xx = mysql_fetch_array($result_aux)) {
        echo '<tr><td>'.$xx['fecha'].'</td><td>'.$xx['estado'].'</td><td>'.$xx['usuario'].'</td><td>'.utf8_encode($xx['observaciones']).'</td></tr>';
     }
     echo '</table></center></div></div>';
?>
    
asked by jeson 02.10.2018 в 20:52
source

2 answers

-1

I could not find the place of the code that you put up, but try with this as a basis as a way to do something by clicking the button. I hope it serves you, and a serious recommendation that you try to send the code a little more orderly so that it is easier to follow what you want to do and explain a little more that you need to be able to help you.

 <form action="" method="post">

<input type="submit" name="EnviarInfo" value="asignar" />


<?php
 if (isset($_POST['EnviarInfo'])) {
 //Aqui comienza con tu codigo, esta es una manera de hacerlo.
  }
 ?>
    
answered by 02.10.2018 в 21:46
-1
        <div align="center">
                <input align="center" name="EnviarInfo" class="btn btn-primary btn-block"  type="submit" style="width: 50%"  value="asignar">
        </div>
  </center>

    <?
if ($_POST[EnviarInfo])
{
   $causa_falla = $_POST['causa_falla'];
      $link = mysqli_connect("localhost","pcomp","KneTPuxJ77f4YLNX", "BBDD");
      $causa = $_POST['tipo'];
      $direccion = $_POST['direccion'];
      $capacidad = $_POST['capacidad'];
      $tipo_cable = $_POST['tipo_cable'];

      $c1 = $_POST['c1'];
      $c2 = $_POST['c2'];
      $c3 = $_POST['c3'];
      $c4 = $_POST['c4'];
      $c5 = $_POST['c5'];
      $date = date('Y-m-d H:i:s');
      $obs = $_POST['obs'];
      $par = $_POST['par'];

  if ($_POST['estado'] == 'Rechazado'){
        $sql = "UPDATE avisos set estado='Rechazado',  fecha_respuesta_aviso='$date', fecha_cierre='$date'
        , par = '$par' , direccion='$direccion',causa_falla='$causa_falla' tipo_cable= '$tipo_cable' $obs='obs' where id_aviso=$id_p";

        $sql2 = "INSERT INTO historico (id_aviso, fecha, estado, usuario, observaciones) values ('$id_p','$date', 'Rechazado', '$aux', '$obs')";

    $sql4 = "INSERT INTO messageTest (notification, status, Fecha, Relevancia, Id_aviso, nivel_usuario, prueba) values ('El aviso $id_p ha sido localizado y se cierra por no ser falla de planta externa.','unread','$date', 'Urgente', '$id_p', '5', '$aux')";

    if(mysqli_query($link, $sql) and mysqli_query($link, $sql2) and mysqli_query($link, $sql4)){

                echo "<script>alert('Cambios realizados', 'asignar juego')</script>"; 

            } else{

                echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
            }

              $yourURL="editar_auditado_id.php?id=$aux";
              //echo ("<script>location.href='$yourURL'</script>");
            echo"<META HTTP-EQUIV='Refresh' CONTENT='0;url=$yourURL'/>"; 



    }
    else if ($_POST['estado'] == 'Aprobado'){

        if ($c1 == " " && $c2 == " " && $c3 == " " && $c4 == " " && $c5 == " " ) {

            echo "<script>alert('Debe ingresar una cuenta como minimo', 'Debe ingresar una cuenta')</script>";

        }else {

            $contadorCuentas = 0;

            if ($c1 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c2 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c3 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c4 == "  " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }

            if ($c5 == " " ) {

                $contadorCuentas = $contadorCuentas + 0;
            }else{

                $contadorCuentas = $contadorCuentas + 1;

            }


            $sql = "UPDATE avisos_auditados set estado='Aprobado', fecha_respuesta_aviso='$date', cuenta1='$c1', cuenta2='$c2',cuenta3='$c3',cuenta4='$c4',cuenta5='$c5', capacidad='$capacidad', causa_falla='$causa_falla',Causa='$tipo',  par = '$par', direccion = '$direccion', tipo_cable='$tipo_cable' where id_aviso=$id_p";

            $sql2 = "INSERT INTO historico (id_aviso, fecha, estado, usuario, observaciones) 
                     VALUES ('$id_p','$date', 'Aprobado juego', '$aux', '$obs')";

            $sql4 = "INSERT INTO messageTest (notification, status, Fecha, Relevancia, Id_aviso, nivel_usuario, prueba, estado_aviso) 
                     VALUES ('El Aviso $id_p ha sido verificado y se encuentra en estado de Aprobado  ','unread','$date', 'Urgente', '$id_p', '5', '$aux', 'Aprobado juego')";


            if(mysqli_query($link, $sql) and mysqli_query($link, $sql2) and mysqli_query($link, $sql4)){

                echo "<script>alert('Cambios realizados', 'asignar juego')</script>"; 

            } else{

                echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
            }

              $yourURL="editar_auditado_id?id=$aux";
              //echo ("<script>location.href='$yourURL'</script>");
            echo"<META HTTP-EQUIV='Refresh' CONTENT='0;url=$yourURL'/>"; 

            }

    }


}

$sql_aux_aux = "SELECT * FROM  'historico' where id_aviso = $id_p";
echo '<div class="container">
      <div class="table-responsive">';
echo '<h4 align="left">Historico</h4>';
echo'<br/><center>';

        echo'<table  id="tablabonita" class="table">';
        echo'<th> ID Fecha</th><th> Estado </th><th> Usuario </th><th> Observaciones </th>';
        $result_aux = mysql_query($sql_aux_aux);
     while ($xx = mysql_fetch_array($result_aux)) {
        echo '<tr><td>'.$xx['fecha'].'</td><td>'.$xx['estado'].'</td><td>'.$xx['usuario'].'</td><td>'.utf8_encode($xx['observaciones']).'</td></tr>';
     }
     echo '</table></center></div></div>';
?>

that's the program of the btn

    
answered by 02.10.2018 в 21:20