Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once '../pruebas/conexion.php';
- $sql_leer = 'SELECT id,usuario,apellidos,email FROM usuarios WHERE id';
- $gsnet = $pdo->prepare($sql_leer);
- $gsnet->execute();
- $resultado = $gsnet->fetchAll();
- ?>
- <form action="envio_alerta.php" method="POST">
- <p>Nombre</p>
- <select class="custom-select mr-sm-2" id="inlineFormCustomSelect">
- <option selected>Elige opción</option>
- <?php foreach ($resultado as $dato): ?>
- <option ><?php echo $dato['usuario']?></option>
- <?php endforeach ?>
- </select>
- <br>
- <br>
- <p>Apellidos</p>
- <select class="custom-select mr-sm-2" id="inlineFormCustomSelect">
- <option selected>Elige opción</option>
- <?php foreach ($resultado as $dato): ?>
- <option><?php echo $dato['apellidos']?></option>
- <?php endforeach ?>
- </select>
- <br>
- <br>
- <p>Email</p>
- <select name="email" name="id" class="custom-select mr-sm-2" id="inlineFormCustomSelect">
- <option selected>Elige opción</option>
- <?php foreach ($resultado as $dato): ?>
- <option value="<?php echo $dato['id']?>"><?php echo $dato['email']?></option>
- <?php endforeach ?>
- </select>
- <br>
- <br>
- <p>Texto</p>
- <div class="form-group z-depth-2">
- <textarea name="alerta" class="form-control" id="exampleFormControlTextarea3" rows="7"></textarea>
- </div>
- </div>
- <div class="text-center py-4 mt-3">
- <button class="btn btn-outline-warning waves-effect z-depth-3" type="submit">Enviar</button>
- </div>
- </form>
- <?php session_start();
- include_once '../pruebas/conexion.php';
- $alerta = $_POST['alerta'];
- $id = $_POST['id'];
- $destino =$_POST['email'];
- $sql_editar = "UPDATE usuarios SET alerta='$alerta' WHERE id='$id'";
- $sentencia_editar = $pdo->prepare($sql_editar);
- $sentencia_editar->execute(array($alerta,$id));
- $contenido= "nEmail: " . $email . "nAlerta: " . $alerta;
- mail($destino, "Contacto", $contenido);
- if (mail){
- echo "<script type='text/javascript'>alert('Tu mensaje ha sido enviado');</script>";
- }
- header('Location: reportes_usuario.php');
Add Comment
Please, Sign In to add comment