PHP - Problemas con select combobox

 
Vista:
sin imagen de perfil

Problemas con select combobox

Publicado por Roberto (1 intervención) el 02/11/2016 04:41:38
Hola que tal necesito de su ayuda cabe mencionar que yo no soy programador lo mio es la infraestructura pero un amigo me solicito apoyo para desarrollar algo para su negocio.
Tengo una tabla cliente tiene ID cliente, nombre del cliente etc
Tengo otra tabla que se llama subcliente id del subcliente, el nombre del subcliente Id del cliente
esto debido a que un cliente puede tener varios subclientes.
Entonces lo que quiero hacer es que en el formato alta de subcliente se seleccione de un combobox el cual alimento de la base de datos clientes, se seleccione el cliente se llene los demas campos y estos se guarden en la tabla subcliente, pero que el select solo me guarde el id_cliente en la tabla subliente.
Según esto el código que les pongo me dice que el alta fue exitosa sin embargo no me hace ningún registro.
Les dejo el código
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html>
<head>
<title>Alta de Subcliente</title>
</head>
<body bgcolor="white" link="#6E6E6E" vlink="#6E6E6E" alink="#6E6E6E">
<center>
<h1>Alta de Subclientes</h1>
<form action="altasubcliente.php" method="post" name="fomulario">
<p><p>Seleccione al Cliente Principal:</p>
      <select name="Id_cliente">
        <option value="0">Selección:</option>
        <?php
			include ("conexionlegu.php");
          $query = $mysqli -> query ("SELECT * FROM clientes_legu");
 
          while ($valores = mysqli_fetch_array($query)) {
 
            echo '<option value="'.$valores[Id_Cliente].'">'.$valores[Cliente].'</option>';
          }
           ?>
      </select></p>
<table>
<tr><td>Subcliente:</td>
<td><input type="text" size="60" name="subcliente"></input></td>
</tr>
<tr><td>Calle</td><td><input type="text" size="60" name="calle"></input></td>
<td>Numero Exterior</td>
<td><input type="text" name="num_ext"></input></td>
<td>Numero Interior</td>
<td><input type="text" name="num_int"></input></td>
</tr>
<tr><td>Colonia</td>
<td><input type="text" size="60" name="colonia"></input></td>
<td>Municipio/Delegacion</td>
<td><input type="text" size="20" name="municipio_delegacion"></input></td>
</tr>
<tr><td>Estado</td>
<td><input type="text" name="estado"></input></td>
<td>CP</td>
<td><input type="text" name="cp"></input></td>
</tr>
<tr><td>Contacto</td>
<td><input type="text" size="60" name="contacto"></input></td>
<td>Telefono</td>
<td><input type="text" name="tel"></input></td>
<td>Extension</td>
<td><input type="text" name="ext"></input></td>
</tr>
<tr><td>Celular</td>
<td><input type="text" name="cel"></input></td>
</tr>
</table>
<br>
<br>
<tr>
<td><input type="submit" name="BotonAlta" value="Alta"></td>
 
<td><input type="button"  name="BotonBack" value=Volver onclick='history.back()'></td>
</tr>
</form>
<?php
if(isset($_POST['BotonAlta']))
{
include ("conexionlegu.php");
$cliente=$_POST["Id_cliente"];
$subcliente=$_POST["subcliente"];
$calle=$_POST["calle"];
$numero_ext=$_POST["num_ext"];
$numero_int=$_POST["num_int"];
$colonia=$_POST["colonia"];
$municipio_delegacion=$_POST["municipio_delegacion"];
$estado=$_POST["estado"];
$cp=$_POST["cp"];
$contacto=$_POST["contacto"];
$tel=$_POST["tel"];
$ext=$_POST["ext"];
$cel=$_POST["cel"];
$mysqli->query("INSERT INTO sublientes(Id_Cliente,Subcliente,Calle,numero_ext,numero_int,Colonia,Municipio_Delegacion,Estado,CP,Contacto,Tel,Ext, Cel) VALUES ('$cliente','$subcliente','$calle','$numero_ext','$numero_int','$colonia','$municipio_delegacion','$estado','$cp','$contacto','$tel','$ext','$cel')");
	include ("cerrar_sesion.php");
	echo"Alta Exitosa";
}
 
?>
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder