Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/11/2010, 23:29
daneco1720
 
Fecha de Ingreso: noviembre-2010
Mensajes: 105
Antigüedad: 13 años, 6 meses
Puntos: 0
Exclamación pasar una fecha desde un formulario y almacenarla en la base de datos

hola de nuevo ya he hecho gran parte de mi codigo en php pero la verdad no tengo ni idea de como pasar la fecha desde mi formulario a la base de datos, uso dreamweaver y no encuentro ninguna opcion por ahi, aqui pongo mi codigo
ayuda¡¡
codigo del archivo del formulario
Código PHP:
<body>
<table width="57%" border="1">
  <tr>
    <th scope="col"><form id="form2" name="form2" method="post" action="tbasig.php">
      <label>administrador<?php
     
include_once "bd/base_anotador.php";
     include_once 
'bd/table.php';
 
 
$tbl = new table('administrador'$base);
 
$tbl->Select('id_admin,nom_admin','','nom_admin');
 echo 
$tbl->GetCombo('id_admin');
  
?></label><br />
      <br />
      codigo de producto
         <?php
     
include_once "bd/base_anotador.php";
     include_once 
'bd/table.php';
 
 
$tbl = new table('productos'$base);
 
$tbl->Select('cod_producto,nom_producto','','nom_producto');
 echo 
$tbl->GetCombo('cod_producto');
  
?>
        </label>
      <p>
        <label> cliente <?php
     
include_once "bd/base_anotador.php";
     include_once 
'bd/table.php';
 
 
$tbl = new table('cliente'$base);
 
$tbl->Select('cod_cliente,nombre','','nombre');
 echo 
$tbl->GetCombo('cod_cliente');
  
?>
          </label>
      </p>
      <p>
        <label>asignar licencia </label><?php
     
include_once "bd/base_anotador.php";
     include_once 
'bd/table.php';
 
 
$tbl = new table('licencia'$base);
 
$tbl->Select('id_licencia,lic_estado','','lic_estado');
 echo 
$tbl->GetCombo('id_licencia');
  
?></label>
      </p>
      <p>fecha de inicio:  </p>
      <div>
        <label>a&ntilde;o
        <input name="aa" type="text" id="aa" />
mes </label>
        <label></label>
        <input name="mm" type="text" id="mm" />
dia
<input type="text" name="textfield2" />
       </div>
      <p>fecha de vencimiento:</p>
      <div>
        <label>a&ntilde;o
          <input name="aa2" type="text" id="aa2" />
          mes </label>
        <label></label>
        <input name="mm2" type="text" id="mm2" />
        dia
  <input type="text" name="textfield22" />
      </div>
      <p>&nbsp; </p>
      <p>
        <label></label>
      </p>
      <p>
        <label>
        <input type="submit" name="Submit" value="Asignar" />
        </label>
      </p>
    </form></th>
  </tr>
</table>
</body>
</html>

aqui esta donde se reciben los datos todos entraban bien hasta q me pidieron ponerle fecha

recibo.php
Código PHP:
<?php 
 
include_once "bd/base_anotador.php";
 include_once 
'bd/table.php';
$base->debug_on(true);
$tbl= new table('asignarlc',$base);
function 
asignar_licencia()
{
global 
$tbl;

$tbl->id_licencia=$_POST['id_licencia'];
$tbl->id_admin=$_POST['id_admin'];
$tbl->cod_producto=$_POST['cod_producto'];
$tbl->cod_cliente=$_POST['cod_cliente'];
$tbl->fecha_inicio=$_POST['aa','mm','dd'];
$tbl->vence=$_POST['aa2','mm2','dd2'];
$tbl->save();
}

 function 
buscar($id)
 {
     global 
$tbl;
     
$tbl->Find($id);
     
$tbl->ShowRecord();
 }
 

if(
asignar_licencia()){

echo 
"la licencia se registro con exito";
}else {echo
"licencia registrada";

}

?>

<html><body>
<p><a href="administrador.php">ADMINISTRADOR</a></p>
<p><a href="asig.php">VOLVER A ASIGNAR  </a></p>
</body>
</html>