Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/01/2015, 06:19
sergioc_g73
 
Fecha de Ingreso: diciembre-2014
Mensajes: 4
Antigüedad: 9 años, 4 meses
Puntos: 0
Inicios con PHP

Hola estoy intentando aprender PHP, pero me ha surgido el primer problema

- Tengo un archivo index.php en el que agregado un formulario a través de un include.

- Tengo el formulario en el archivo form1.php.

Mi problema viene porque cuando intento agregar algo a la base de datos no hace nada.

--- index.PHP ---

body>
<?php include("/formularios/form1.php"); ?>

<?php
$conexion=mysql_connect("localhost","root","") or die("Problemas en la conexion");
mysql_select_db("base1",$conexion) or die("Problemas en la seleccion de la base de datos");
mysql_query("INSERT INTO alumnos(nombre,mail,codigocurso) VALUES 'Sergio','[email protected]','2012')");
?>
</body>

---form1.php---

<form id="form1" name="form1" method="post" action="../index.php">
Ingrese nombre:
<input type="text" name="nombre"/><br>
Ingrese mail:
<input type="text" name="mail"/><br>
Seleccione el curso:
<select name="codigocurso">
<option value="1">PHP</option>
<option value="2">ASP</option>
<option value="3">JSP</option>
</select>
<br>
<input type="submit" value="registrar"/>
</form>