Código PHP:
<?php require_once('Connections/registro_preguntas.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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 registro (Nombre, Apellido, Email, Ciudad, Preg1, Preg2, Preg3, Preg4, Preg5, Preg6, Preg7, Preg8, Preg9, Preg10, Preg11) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['ciudad'], "text"),
GetSQLValueString($_POST['GrupoOpciones1'], "text"),
GetSQLValueString($_POST['GrupoOpciones2'], "text"),
GetSQLValueString($_POST['GrupoOpciones3'], "text"),
GetSQLValueString($_POST['GrupoOpciones4'], "text"),
GetSQLValueString($_POST['GrupoOpciones5'], "text"),
GetSQLValueString($_POST['GrupoOpciones6'], "text"),
GetSQLValueString($_POST['GrupoOpciones7'], "text"),
GetSQLValueString($_POST['GrupoOpciones8'], "text"),
GetSQLValueString($_POST['GrupoOpciones9'], "text"),
GetSQLValueString($_POST['GrupoOpciones10'], "text"),
GetSQLValueString($_POST['GrupoOpciones11'], "text"));
mysql_select_db($database_registro_preguntas, $registro_preguntas);
$Result1 = mysql_query($insertSQL, $registro_preguntas) or die(mysql_error());
$insertGoTo = "registro_ok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<?php require_once('Connections/registro_preguntas.php'); ?>
<!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>Registro</title>
<style type="text/css">
<!--
.Estilo10 {
color: #003300;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
}
body {
background-color: #E4FAED;
background-repeat: repeat;
background-image: url();
}
.Estilo14 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #336600; }
.Estilo20 {
font-style: italic;
font-size: 12px;
font-weight: normal;
}
.Estilo22 {font-size: 16px}
#Layer1 {
position:relative;
width:202px;
height:41px;
z-index:1;
left: 20px;
top: 20px;
}
.Estilo9 { color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
.Estilo29 {font-size: 11px; color: #333333; }
.Estilo31 {font-family: Arial, Helvetica, sans-serif}
.Estilo32 {font-family: Arial, Helvetica, sans-serif; font-style: italic; }
-->
</style>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//-->
</script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="927" height="687" align="center" cellspacing="0">
<tr>
<th width="919" height="685" bgcolor="#FFFFFF" scope="col"><form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<th height="32" colspan="2" scope="col"><span class="Estilo31"><em>Registro</em></span></th>
</tr>
<tr>
<td width="64" height="28" class="Estilo7"><div align="left" class="Estilo10"><span class="Estilo22">*</span>Nombre</div></td>
<td width="831"><div align="left"><span id="sprytextfield1">
<input name="nombre" type="text" id="nombre" size="30" />
<span class="textfieldRequiredMsg">Ingrese su nombre</span></span></div></td>
</tr>
<tr>
<td height="29" class="Estilo7"><div align="left" class="Estilo10"><span class="Estilo22">*</span>Apellido</div></td>
<td><div align="left"><span id="sprytextfield2">
<input name="apellido" type="text" id="apellido" size="30" />
<span class="textfieldRequiredMsg">Ingrese su apellido</span></span></div></td>
</tr>
<tr>
<td height="30" class="Estilo7"><div align="left" class="Estilo10"><span class="Estilo22">*</span>E-Mail</div></td>
<td><div align="left"><span id="sprytextfield3">
<input name="email" type="text" id="email" size="30" />
<span class="textfieldRequiredMsg">Ingrese su e-mail</span><span class="textfieldInvalidFormatMsg">E-mail no válido.</span></span></div></td>
</tr>
<tr>
<td class="Estilo7"><div align="left" class="Estilo10"><span class="Estilo22">*</span>Ciudad</div></td>
<td><div align="left"><span id="spryselect1"><span class="selectInvalidMsg">Seleccione un país</span></span></div> <div align="left"><span id="sprytextfield4">
<input name="ciudad" type="text" id="ciudad" size="30" />
<span class="textfieldRequiredMsg">Ingrese su ciudad</span></span></div></td>
</tr>
<tr>
<td height="19" class="Estilo7"> </td>
<td> </td>
</tr>
<tr>
<td height="26" class="Estilo7"> </td>
<td> </td>
</tr>
<tr>
<td height="26" colspan="2" class="Estilo20"> <div align="left" class="Estilo31"><br />
<br />
</div></td>
</tr>
</table>
<table width="902" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#DFF2DF">
<tr>
<th height="35" colspan="2" class="Estilo32" scope="col">Preguntas</th>
</tr>
<tr>