Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/08/2011, 12:58
Anna Carolina
 
Fecha de Ingreso: febrero-2007
Ubicación: Caracas
Mensajes: 148
Antigüedad: 18 años, 1 mes
Puntos: 6
Formulario de Login + Inclusion de Reg en tabla.

Buenas no se si esto se pueda, tengo un formulario donde atravez del el el usuario inicia seccion , la cual es manejado desde una tabla de Registro(Usuarios)
es lo siguiente, necestio que cuando inicie seccion se inserten en la tabla Pedido, los siguiente: id_pedido(autoIncrement) id(id_usuario) y fecha. el formulario seria el siguiente

Código PHP:
<?php
session_start
();
if (isset (
$_POST['submit'] )){
    
$data_root $_SERVER[DOCUMENT_ROOT];
    include (
$data_root "/site/sec/funciones.php");
    
$nick $_POST['email'];
    
$nick $_POST['nick'];
    
$password $_POST['password'];
    
$fecha date("d-m-Y");
    
//CREACION DE VARIABALES - INICIO DE SESION
    
$sql mysql_query("SELECT * FROM registro WHERE nick='$nick' OR email='$nick' AND password='$password'");
    
$login_check mysql_num_rows($sql);
    
    
//CREACION DE SESION
    
if($login_check 0){
        if(
$row mysql_fetch_array($sql)){
            
$id $row["id"];
            
session_register('id');
            
$_SESSION['id'] = $id;
            
$usuario $row["nick"];
            
session_register('usuario');
            
$_SESSION['usuario'] = $usuario;
            
header("location: index.php");
        exit();
        } 
    } else {
          
?>
            <SCRIPT LANGUAGE="javascript"> 
            location.href = "registro.php"; 
            </SCRIPT> 
            <?php  
    
}
}
// close if post
?>
<?php 

 
echo $fecha;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Inicio de Sesion</title>
</head>

<body>
<div>
<table align="center" cellpadding="5">
<form action="login.php" method="post" enctype="multipart/form-data" name="logform" id="logform">
<tr>
    <td>Nick<input name="nick" type="text" id="nick" size="15" maxlength="15"/></td>
    </tr>
<tr>
    <td>Contrase&ntilde;a
      <input name="password" type="password" id="password" size="15" maxlength="15" /></td>
    </tr>
<tr>
    <td align="center"><input name="submit" type="submit" value="Login" id="submit"/>
    </td>
    </tr>
</form>
</table>
</div>
</body>
</html>
Tengo un formulario en el catalogo, donde tengo un check para cada producto y un boton, es el siguiente:

Código PHP:
<?php
echo "<td width='280' align='center'><div class='catalogo_descripcion'><form name='visita' action='visitas.php' method='POST'>
<input type='hidden' name='CodigoProducto' value='"
.$row[CodigoProducto]."'>
<a href='detalle.php?pag=detalle&id=" 
$row[CodigoProducto] . "'><button name='Visitass' type='submit' name='Visitass'  value='Visitass'>
<img src='" 
$imagen "' border='0' alt='" $row[Descripcion] . "' width= '150' height='150'/><h1>" ucwords(strtolower($row[Descripcion])) . "
</h1><h2>REF: " 
$row[Referencia] . "</h2><h3>Precio: BsF:  $row[PrecioUnitario1]  . </h3><a href='detalle.php?pag=detalle&id=" $row[CodigoProducto] . "'></div></button></a></form><form action='pedido.php'><table width='180' border='0'>
  <tr>
    <td><input name='' type='checkbox' value='' /><input name='' type='button' value='Añadir' /></td>
  </tr>
</table>
</form></td>\n"
;
?>
Aqui necesitaria indicar si no hice login, que me mande al formulario y si hice login la cual ya registro la cabecera del pedido continue seleccionando,y agregando al pedido, tengo un archivo llamado pedido.php donde voy a ir almacenando los productos seleccionados.
Ok primero lo primero necesito es guardar los datos principales del pedido, desde que inice session...
Espero que me puedan ayudar u orientar, con esta medio base que tengo