adjunto el codigo que tengo hasta el momento:
Código PHP:
<?php require_once('Connections/local.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO tematicas (tematicaNombre, docenteId, tematicasMaterial) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['tematicaNombre'], "text"),
GetSQLValueString($_POST['docenteId'], "int"),
GetSQLValueString($_POST['tematicasMaterial'], "text"));
mysql_select_db($database_local, $local);
$Result1 = mysql_query($insertSQL, $local) or die(mysql_error());
$insertGoTo = "cursos.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_local, $local);
$query_consultadocentes = "SELECT * FROM docentes";
$consultadocentes = mysql_query($query_consultadocentes, $local) or die(mysql_error());
$row_consultadocentes = mysql_fetch_assoc($consultadocentes);
$totalRows_consultadocentes = mysql_num_rows($consultadocentes);
?>
<!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"><!-- InstanceBegin template="/Templates/plantillabase.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Documento sin título</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="css/estiloprincipal.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/menu.css" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Belleza&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link href="css/cuadroregistro.css" rel="stylesheet" type="text/css" />
<link href="css/cuadrologin.css" rel="stylesheet" type="text/css" />
<link href="css/cuadrosubircurso.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
<div class="header">
<?php include("includes/cabecera.php"); ?>
<div class="clearfloat"></div>
<?php include("includes/menu.php"); ?>
<?php include("includes/sesion.php"); ?>
</div>
<div class="sidebar1"><!-- InstanceBeginEditable name="ContenidoIzq" --> <!-- InstanceEndEditable --><!-- end .sidebar1 --></div>
<div class="content"><!-- InstanceBeginEditable name="ContenidoDer" --> Completa la siguiente informacion para proceder a crear tu curso:
<div id ="cuadrosubircurso">
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">TematicaNombre:</td>
<td><input type="text" name="tematicaNombre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">DocenteId:</td>
<td><select name="docenteId">
<?php
do {
?>
<option value="<?php echo $row_consultadocentes['docenteId']?>" ><?php echo $row_consultadocentes['docenteId']?></option>
<?php
} while ($row_consultadocentes = mysql_fetch_assoc($consultadocentes));
?>
</select></td>
</tr>
<tr> </tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">TematicasMaterial:</td>
<td><input type="text" name="tematicasMaterial" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Insertar registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</div>
<!-- end .content -->
<!-- InstanceEndEditable --></div>
<div class="footer">
<?php include("includes/pie.php"); ?>
</div>
<!-- end .container --></div>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($consultadocentes);
?>