![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
11/02/2015, 17:40
|
![Avatar de Tecan777](http://static.forosdelweb.com/customavatars/avatar564970_1.gif) | | | Fecha de Ingreso: febrero-2015 Ubicación: tehuaca,Puebla,Mexico
Mensajes: 18
Antigüedad: 10 años Puntos: 1 | |
Respuesta: eliminar un valor seleccionado de un combobox en php-mysql Hola buenas tardes, he logrado el objetivo, en vez de redirigir a un archivo php en otra pagina, realice mediante un botón dentro de la misma pagina html en la parte superior, y corregí unos parámetros sobre select y la consulta, les dejo el código para que a alguien le sea de ayuda, muchas gracias...
<?php
$conexion=mysqli_connect("localhost","root","");
mysqli_select_db($conexion,"itecia");
if(isset($_POST['usuario']))
{
$name=$_POST['usuario'];
mysqli_query($conexion,"delete from usuarios where login = '$name';" );
}
?>
<html>
<head>
<title>boton select</title>
</head>
<body>
<form name="delete" method='POST' action="" >
<select name='usuario' onchange='submit()'>
<?php
ECHO error_reporting(0);
$rec=mysqli_query($conexion,"select * from usuarios");
while($row=mysqli_fetch_array($rec))
{
echo "<option value='".$row['login']."'";
echo"SELECTED";
echo ">";
echo $row['login'];
echo "</option>";
}
?>
</select>
<input type="submit" name="delete" value="Delete" id="delete"/>
</form>
</body>
</html> |