1
					C, C++, C#, Java, Visual Basic, HTML, PHP, CSS, Javascript, Ajax, Joomla, MySql y más / query INSERT TO con PHP insertar valores obtenidos por post concatenar texto
« en: 24 de Diciembre 2014, 06:23 »
					tengo el siguiente código ,que debería guardarme los datos ingresados del formulario pero tengo un error
ayuda¡¡¡¡¡¡¡¡¡¡¡
procesar.php
conexion.php
formulario.php
					
				ayuda¡¡¡¡¡¡¡¡¡¡¡
procesar.php
Código: [Seleccionar]
<?php
include("conexion.php");
     if(isset($_POST['nombre']) && !empty($_POST['nombre'])&&
     isset($_POST['telefono'] )&& !empty($_POST['telefono']))
    
	 {
	 $conexion=mysql_connect($host,$user,$pw)or die ("error al conectar");
	 mysql_select_db($bd,$conexion)or die ("error al conectar");
	 
	 mysql_query("INSERT INTO profesores (nombre,telefono)
	 VALUES('$_POST[nombre]','$_POST[telefono]')",$conexion);
	 echo "datos insertados correctamente";
	 }else{
	 echo"error al insertar datos";
	 
	 }
	 
?>conexion.php
Código: [Seleccionar]
<?php
$host="localhost";
$user="root";
$pw="";
$bd="pagina";
?>
formulario.php
Código: [Seleccionar]
<html>  
<head>  
<title>Guardar datos en una base de datos</title>  
</head>  
<body>  
<form action="procesar.php" method="post" name="form">  
<table width="200" border="0">
<tr>
    <td>Nombre</td> 
	<td><input type="text" name="nombre" /></td> 
</tr>	
    <tr>
    <td>Telefono</td> 
	<td><input type="number" name="telefono" /></td> 
</tr>
      <tr>
    <td> </td> 
	<td><input type="submit" value="Insertar datos" /></td> 
</tr>
   </table>
      
</form>  
</body>  
</html>  
			 Mostrar Mensajes
Mostrar Mensajes
			 
					 
 
					 
					 RSS
RSS