Ver Mensaje Individual
  #13  
Antiguo 25-07-2007
ghato168 ghato168 is offline
Miembro
 
Registrado: jun 2007
Posts: 10
Reputación: 0
ghato168 Va por buen camino
Cool Conectar Mysql con php

Cita:
Empezado por maximo_nashir
$this->table1->post();
como puedo conectar mi base de datos mysql con php, cuales son los pasos y otra cosa e creado mi formualrio en .html con combobox y cada combobox tiene su items digamne como peudo hacer paraq cuando haga click en tl boton registrar del formulrio html se inserte en la base de datos...

el codigo de mi formulario html es este.

<!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>Registro de Notas</title>
<style type="text/css">
<!--
.Estilo1 {
font-size: 18px;
font-family: "Monotype Corsiva";
font-weight: bold;
color: #0000FF;
}
-->
</style>
</head>

<body>
<form id="form1" name="fp" method="post" action="prueba.php">
<label><span class="Estilo1">Registrar Notas Alumno:</span><br />
<br />
<strong>Id Curso:</strong>

<select name="Curso" id="Curso">
<option>MT1</option>
<option>LP5</option>
<option>BD</option>
<option>L1</option>
<option>EII</option>
<option>S1</option>
</select>
<br />
<br />
<strong>Unidad: </strong> </label>

<label>
<select name="Unidad" id="Unidad">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</label>
<p>
<label>
<strong>Id Alumno</strong>:
<input type="text" name="Alumno" id="Alumno" />
</label>
</p>
<p><strong>Nota:
<label> </label>
</strong>
<label>
<select name="Nota" id="Nota">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
</select>
<br />
</label>
<label>
<input type="submit" name="Enviar" id="Enviar" value="Enviar" />
</label>
</p>
</form>
</body>
</html>
y el codigo q sigo en el php es el siguiente: prueba.php

<?php

xcurso = $_post['curso'];
xunidad = $_post['unidad'];
xalumno = $_post['alumno'];
xnota = $_post['nota];

$bdconex = @mysql_connect("localhost", "root", "");

$res= mysql_select_db("NotaAlumno", $bdconex);

mysql_query("INSERT INTO Regnota (idalumno, unidad, nota, idcurso)
VALUES ('$alumno', '$unidad', '$nota', '$curso' )");




?>


si alguien tien un ejemplo parecido si me lo pudiera psar soy nuevo en esto necesito ayuda .. se los agradesco de antemano
Responder Con Cita