Tema: Unir datos
Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/07/2012, 10:43
Zota
 
Fecha de Ingreso: julio-2012
Mensajes: 51
Antigüedad: 11 años, 9 meses
Puntos: 0
Respuesta: Unir datos

Que molestia ho he podido realizar o cumplir la tarea aqui pongo el codigo para que ustedes me digan que hago mal.

Código PHP:
<?php
$state 
false;
if (
$_POST['action'] == "add") { 
    
$conexion mysql_connect("localhost""root""123456");
    
mysql_select_db("davincci"$conexion);
    
$a=uno;
    
$b=dos;
    
$c=dir;
    
$cadena=$a.$b.$c;
    
$que "INSERT INTO empresa (nombre, direccion, telefono) ";
    
$que.= "VALUES ('".$_POST['nombre']."', '".$_POST['$cadena']."', '".$_POST['fono']."') ";
    
$res mysql_query($que$conexion) or die(mysql_error());
    
$state true;
}
?>
<!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=iso-8859-1" />
<title>Insertar datos en MySQL</title>
<style type="text/css">
<!--
body {
    font-family: "Trebuchet MS", Tahoma, Arial;
    font-size: 12px;
    color: #333333;
}
h2 {
    font-size: 16px;
    color: #CC0000;
}
input, select {
    font-family: "Trebuchet MS", Tahoma, Arial;
    font-size: 11px;
    color: #666666;
}
-->
</style>
</head>
<body>
<h2>Insertar datos en MySQL</h2>
<form id="insertar" name="insertar" method="post" action="">
  <p>Nombre:
    <input name="nombre" type="text" id="nombre" size="50" />
  </p>
  <p>Menu
    <label>
    <select name="uno" id="uno">
      <option value="BG">BOGOTA</option>
      <option value="CA">CALI</option>
        </select>
    </label>
</p>
  <p>Menu 2 
    <label>
    <select name="dos" id="dos">
      <option value="PT">PUTUMAYO</option>
      <option value="LL">LLANOS</option>
        </select>
    </label>
  </p>
  <p>Direccion:
    <input name="dir" type="text" id="dir" size="50" />
  </p>
  <p>Telefono:
    <input name="fono" type="text" id="fono" size="50" />
  </p>
  <input type="submit" name="Submit" value="Insertar Registro" />
  <input type="hidden" name="action" value="add" />
</form>
<?php if ($state) { ?>
<p><em>Registro insertado correctamente</em></p>
<?php ?> 
</body>
</html>