Ver Mensaje Individual
  #11 (permalink)  
Antiguo 17/01/2013, 10:34
Avatar de Nicoeas
Nicoeas
 
Fecha de Ingreso: abril-2011
Ubicación: Argentina
Mensajes: 85
Antigüedad: 13 años, 1 mes
Puntos: 8
Respuesta: Formulario PHP con conexion MySQL

Muchacho, voy asi:

Index.php:
Código PHP:
Ver original
  1. <?php include("conect.php");
  2. $v1=$_GET['1'];//recuperamos la primer variable estara en .com/estaeslavariable/
  3. $Fecha=$_POST['Fecha'];//En caso de que el usuario escriba una frase aqui la recibiremos
  4. $Nombre=$_POST['Nombre'];
  5. $Domicilio=$_POST['Domicilio'];
  6. $Telefono=$_POST['Telefono'];
  7. $Pedido=$_POST['Pedido'];
  8. $Monto=$_POST['Monto'];
  9. $Entrega=$_POST['Entrega'];
  10. $se=$_POST['se'];//para evitar un poco a los robots
  11. $tucompu=$_POST['tucompu'];//si es un bot de spam, esto estara con info, y no procedemos!
  12. $dominio=$_SERVER['HTTP_HOST'];//haci no tendras que escribir tu dominio en todos los links!!!
  13.  
  14. ?>    
  15.  
  16. <!DOCTYPE html>
  17. <html>
  18.     <head>
  19.         <title>Clientes</title>
  20. </head>
  21.     <body>
  22.  
  23. <h1>Registrar Nuevo Cliente</h1>
  24.  
  25. <form>
  26. <input type="text" name="Fecha" value="Fecha" id="Fecha" size="40" data-label="Fecha" class="Fecha"> </br>
  27. <input type="text" name="Nombre" value="Nombre" id="Nombre" size="40" data-label="Nombre" class="Nombre"> </br>
  28. <input type="text" name="Domicilio" value="Domicilio" id="Domicilio" size="40" data-label="Domicilio" class="Domicilio"> </br>
  29. <input type="text" name="Telefono" value="Telefono" id="Telefono" size="40" data-label="Telefono" class="Telefono"> </br>
  30.  
  31. <textarea name="Pedido" value="Pedido" id="Pedido" rows="6" cols="31" data-label="Pedido" class="Pedido">Pedido</textarea> </br>
  32.  
  33. <input type="text" name="Monto" value="Monto" id="Monto" size="40" data-label="Monto" class="Monto"> </br>
  34. <input type="text" name="Entrega" value="Entrega" id="Entrega" size="40" data-label="Entrega" class="Entrega"> </br>
  35.  
  36.  
  37. <input type="submit" name="Enviar" value="Enviar" id="Enviar" data-label="Enviar" class="Enviar">
  38. </form>
  39.  
  40. </body>
  41. </html>

conect.php:
Código PHP:
Ver original
  1. <?
  2. mysql_select_db("a5151937_cliente",mysql_connect("localhost","usuario","pass"));
  3. ?>

database:
Código SQL:
Ver original
  1. -- phpMyAdmin SQL Dump
  2. -- version 2.11.4
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Host: localhost
  6. -- Generation Time: Jan 17, 2013 at 11:30 AM
  7. -- Server version: 5.1.57
  8. -- PHP Version: 5.2.17
  9.  
  10. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  11.  
  12. --
  13. -- Database: `a5151937_cliente`
  14. --
  15.  
  16. -- --------------------------------------------------------
  17.  
  18. --
  19. -- Table structure for table `Clientes`
  20. --
  21.  
  22. CREATE TABLE `Clientes` (
  23.   `Fecha` text COLLATE latin1_general_ci NOT NULL,
  24.   `Nombre` text COLLATE latin1_general_ci NOT NULL,
  25.   `Domicilio` text COLLATE latin1_general_ci NOT NULL,
  26.   `Telefono` text COLLATE latin1_general_ci NOT NULL,
  27.   `Pedido` text COLLATE latin1_general_ci NOT NULL,
  28.   `Monto` text COLLATE latin1_general_ci NOT NULL,
  29.   `Entrega` text COLLATE latin1_general_ci NOT NULL
  30. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
  31.  
  32. --
  33. -- Dumping data for table `Clientes`
  34. --

Como voy? que me falta? Muchas gracias
__________________
Nicoeas