Foros del Web » Programando para Internet » PHP »

lista/menu

Estas en el tema de lista/menu en el foro de PHP en Foros del Web. Tengo 2 campos en un lista/menu y no se como hacer para q me quede guardada en la base de datos con algun campo dentro ...
  #1 (permalink)  
Antiguo 06/11/2006, 11:10
Avatar de hulray  
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 7 meses
Puntos: 3
lista/menu

Tengo 2 campos en un lista/menu y no se como hacer para q me quede guardada en la base de datos con algun campo dentro de el.

Código PHP:
<?  
session_start
();  
echo 
$_SESSION['usuario'];  
if(empty(
$_SESSION['usuario'])) {  
  
header("location: noautorizado.php");  
  exit;
}  

if (
$_SESSION['usuario_nivel'] != "100"){  
  
header("location: noautorizado_nivel.php");  
  exit;  
}  
    
</
div>
<
form name="form1" method="post" action="agregar.php">
                                                  <
pre>     <strong>Cliente</strong>                                       Fecha Inicio:
Nombre:      <input type="text" name="nombre">                 <input type="text" name="fecha_inicio">
Empresa:     <input type="text" name="empresa">                    Fecha Termino:
RUT:         <input type="text" name="rut" size="9" maxlength="8"> - <input type="text" name="rut2" size="1" maxlength="1">                  <input type="text" name="fecha_termino">    
Telefono:    <input type="text" name="telefono">

   <
strong>Detalle Vehiculo</strong>                        Forma de pago:
Marca:       <input type="text" name="marca">           <select name="campo">     <option value="boleta">Boleta</option>     <option value="factura">Factura</option> </select>
Modelo:      <input type="text" name="modelo">
A&ntilde;o:         <input type="text" name="ano">
Patente:     <input type="text" name="patente">
Kilometraje: <input type="text" name="kilometraje">
Serie Motor: <input type="text" name="serie_motor">

  <
strongDetalle Servicios</strong>

          
Orden de Trabajo                     H/H      Valor      Repuestos
<input name="n1" type="text" size="55"> <input name="n1hh" type="text" size="3"> $<input name="n1valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n1repuesto" type="text" onChange="sumar()" value="" size="10">                                                   
<
input name="n2" type="text" size="55"> <input name="n2hh" type="text" size="3"> $<input name="n2valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n2repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n3" type="text" size="55"> <input name="n3hh" type="text" size="3"> $<input name="n3valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n3repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n4" type="text" size="55"> <input name="n4hh" type="text" size="3"> $<input name="n4valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n4repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n5" type="text" size="55"> <input name="n5hh" type="text" size="3"> $<input name="n5valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n5repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n6" type="text" size="55"> <input name="n6hh" type="text" size="3"> $<input name="n6valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n6repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n7" type="text" size="55"> <input name="n7hh" type="text" size="3"> $<input name="n7valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n7repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n8" type="text" size="55"> <input name="n8hh" type="text" size="3"> $<input name="n8valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n8repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n9" type="text" size="55"> <input name="n9hh" type="text" size="3"> $<input name="n9valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n9repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n10" type="text" size="55"> <input name="n10hh" type="text" size="3"> $<input name="n10valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n10repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n11" type="text" size="55"> <input name="n11hh" type="text" size="3"> $<input name="n11valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n11repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n12" type="text" size="55"> <input name="n12hh" type="text" size="3"> $<input name="n12valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n12repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n13" type="text" size="55"> <input name="n13hh" type="text" size="3"> $<input name="n13valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n13repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n14" type="text" size="55"> <input name="n14hh" type="text" size="3"> $<input name="n14valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n14repuesto" type="text" onChange="sumar()" value="" size="10">
<
input name="n15" type="text" size="55"> <input name="n15hh" type="text" size="3"> $<input name="n15valor" type="text" onChange="sumar()" value="" size="10"> $<input name="n15repuesto" type="text" onChange="sumar()" value="" size="10">
                                     
SubTotal:      $<input name="total_valor" type="text" readonly style="borde:0" size="10"> $<input name="total_repuesto" type="text" readonly style="borde:0" size="10">
                                     
Descuento:                  %<input name="descuento" type="text" onChange=="sumar()" value="0" size="10">
                                     
Neto:                       $<input name="neto" type="text" onChange=="sumar()" readonly style="borde:0" size="10">
                                     
Iva:                        $<input name="iva" type="text" onChange="sumar()" readonly style="borde:0" size="10">
                                     
Total:                      $<input name="total" type="text" readonly style="borde:0" size="10" >
Nota: <input name="nota" type="text" size="90" maxlength="90">
      <
input name="textfield" type="text" size="90">                                                  
</
pre>
                                                  <
div id="divButtons" name="divButtons">  
                                                    <
input type="button" value "Print this page" onclick="printPage()" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;">
                                                    <
input type="button" name="Calcular" value="Calcular Descuento" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;" onClick="Kalkula('form1','neto','descuento','total')" />
                                                    <
input name="button" type="button" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;" onClick="validar(this.form)" value="Validar Rut">
                                                    <
input type="button" onClick="document.forms[0].submit()" style="font:bold 11px verdana;color:#FF0000;background-color:#FFFFFF;" name="Guardar" value="Guardar">
  </
div>
</
form>
agrega.php:
Código PHP:
<?php
   
include("conec.php");
   
$link=Conectarse();
$nombre=$_POST['nombre']; 
if(
$nombre==NULL
 { 
 } 
else 
 { 
   
$Sql="insert into cliente (nombre,empresa,rut,rut2,telefono,fecha_inicio,fecha_termino,boleta,factura,marca,modelo,ano,patente,kilometraje,serie_motor,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n1hh,n2hh,n3hh,n4hh,n5hh,n6hh,n7hh,n8hh,n9hh,n10hh,n11hh,n12hh,n13hh,n14hh,n15hh,n1valor,n2valor,n3valor,n4valor,n5valor,n6valor,n7valor,n8valor,n9valor,n10valor,n11valor,n12valor,n13valor,n14valor,n15valor,n1repuesto,n2repuesto,n3repuesto,n4repuesto,n5repuesto,n6repuesto,n7repuesto,n8repuesto,n9repuesto,n10repuesto,n11repuesto,n12repuesto,n13repuesto,n14repuesto,n15repuesto,nota,total_valor,total_repuesto,descuento,neto,iva,total)  values ('".$_POST["nombre"]."','".$_POST["empresa"]."', '".$_POST["rut"]."', '".$_POST["rut2"]."','".$_POST["telefono"]."','".$_POST["fecha_inicio"]."','".$_POST["fecha_termino"]."','".$_POST["boleta"]."','".$_POST["factura"]."','".$_POST["marca"]."','".$_POST["modelo"]."','".$_POST["ano"]."','".$_POST["patente"]."','".$_POST["kilometraje"]."','".$_POST["serie_motor"]."','".$_POST["n1"]."','".$_POST["n2"]."','".$_POST["n3"]."','".$_POST["n4"]."','".$_POST["n5"]."','".$_POST["n6"]."','".$_POST["n7"]."','".$_POST["n8"]."','".$_POST["n9"]."','".$_POST["n10"]."','".$_POST["n11"]."','".$_POST["n12"]."','".$_POST["n13"]."','".$_POST["n14"]."','".$_POST["n15"]."','".$_POST["n1hh"]."','".$_POST["n2hh"]."','".$_POST["n3hh"]."','".$_POST["n4hh"]."','".$_POST["n5hh"]."','".$_POST["n6hh"]."','".$_POST["n7hh"]."','".$_POST["n8hh"]."','".$_POST["n9hh"]."','".$_POST["n10hh"]."','".$_POST["n11hh"]."','".$_POST["n12hh"]."','".$_POST["n13hh"]."','".$_POST["n14hh"]."','".$_POST["n15hh"]."','".$_POST["n1valor"]."','".$_POST["n2valor"]."','".$_POST["n3valor"]."','".$_POST["n4valor"]."','".$_POST["n5valor"]."','".$_POST["n6valor"]."','".$_POST["n7valor"]."','".$_POST["n8valor"]."','".$_POST["n9valor"]."','".$_POST["n10valor"]."','".$_POST["n11valor"]."','".$_POST["n12valor"]."','".$_POST["n13valor"]."','".$_POST["n14valor"]."','".$_POST["n15valor"]."','".$_POST["n1repuesto"]."','".$_POST["n2repuesto"]."','".$_POST["n3repuesto"]."','".$_POST["n4repuesto"]."','".$_POST["n5repuesto"]."','".$_POST["n6repuesto"]."','".$_POST["n7repuesto"]."','".$_POST["n8repuesto"]."','".$_POST["n9repuesto"]."','".$_POST["n10repuesto"]."','".$_POST["n11repuesto"]."','".$_POST["n12repuesto"]."','".$_POST["n13repuesto"]."','".$_POST["n14repuesto"]."','".$_POST["n15repuesto"]."','".$_POST["nota"]."','".$_POST["total_valor"]."','".$_POST["total_repuesto"]."', '".$_POST["descuento"]."','".$_POST["neto"]."','".$_POST["iva"]."','".$_POST["total"]."')";      
   
mysql_query($Sql,$link); 
   
header("Location: insertareg.php");
 }  
?>

Última edición por hulray; 06/11/2006 a las 11:21
  #2 (permalink)  
Antiguo 06/11/2006, 11:30
Avatar de mauled  
Fecha de Ingreso: marzo-2005
Ubicación: Cd. de México.
Mensajes: 3.001
Antigüedad: 19 años, 1 mes
Puntos: 33
De acuerdo

Cita:
Tengo 2 campos en un lista/menu y no se como hacer para q me quede guardada en la base de datos con algun campo dentro de el.
No acabo de entender tu problema
Si pudieras detallarlo más, te lo agradeceria muchisimo.

Saludillos.
  #3 (permalink)  
Antiguo 06/11/2006, 11:43
Avatar de hulray  
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 7 meses
Puntos: 3
No me guarda en la base de datos este campo

Código PHP:
<select name="campo">    <option value=""></option>   
<
option value="boleta">Boleta</option>     <option value="factura">Factura</option> </select
tambien que al darle por ejemplo a factura y agregarle o adaptarle este codigo que tengo:
Código PHP:
  <input type="button" value="Imprimir" onclick="javascript:window.open('ver.php', 'noimporta','width=800, height=1000, scrollbars=yes')"
  #4 (permalink)  
Antiguo 06/11/2006, 11:52
Avatar de mauled  
Fecha de Ingreso: marzo-2005
Ubicación: Cd. de México.
Mensajes: 3.001
Antigüedad: 19 años, 1 mes
Puntos: 33
1) Pues en tu query no observo que tengas $_POST['campo'];

2) No entiendo que quieras hacer con la "adaptación" de código.


Porfavor abunda más un tus problemas.

Saludillos.
  #5 (permalink)  
Antiguo 06/11/2006, 12:00
Avatar de hulray  
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 7 meses
Puntos: 3
ya entendi tu paso 1, la adaptacion es que cuando el usuario selecciona por ejemplo factura y al estar ahi que se me abra un pequeño recuadro donde salgan las opciones al contado o a 30 dias.
  #6 (permalink)  
Antiguo 06/11/2006, 12:25
Avatar de mauled  
Fecha de Ingreso: marzo-2005
Ubicación: Cd. de México.
Mensajes: 3.001
Antigüedad: 19 años, 1 mes
Puntos: 33
Pues si quieres que se genere un evento al seleccionar algun elemento de tu select, tendrias que usar la función onChange de javascript es decir:


<select name='campo' onChange="javascript:window.open('ver.php', 'noimporta','width=800, height=1000, scrollbars=yes')">


Saludillos.
  #7 (permalink)  
Antiguo 06/11/2006, 12:48
Avatar de hulray  
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 7 meses
Puntos: 3
gracias por tu paciencia, :D
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:55.