![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
Les muestro:
Código PHP:
<?php require_once('../Connections/conexion.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 usuarios (id_user, Nombre, Apellidos, Mail, Edad, Empresa, Dir, Ciudad, Telefono, Deporte, Password) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id_user'], "int"),
GetSQLValueString($_POST['Nombre'], "text"),
GetSQLValueString($_POST['Apellidos'], "text"),
GetSQLValueString($_POST['Mail'], "text"),
GetSQLValueString($_POST['Edad'], "text"),
GetSQLValueString($_POST['Empresa'], "text"),
GetSQLValueString($_POST['Dir'], "text"),
GetSQLValueString($_POST['Ciudad'], "text"),
GetSQLValueString($_POST['Telefono'], "text"),
GetSQLValueString($_POST['Deporte'], "text"),
GetSQLValueString($_POST['Password'], "text"));
mysql_select_db($database_conexion, $conexion);
$Result1 = mysql_query($insertSQL, $conexion) or die(mysql_error());
$insertGoTo = "conf_registro.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
session_start();
$_SESSION['nom']=$_POST['Nombre'];
$_SESSION['mai']=$_POST['Mail'];
$_SESSION['pass']=$_POST['Password'];
?><!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 de Usuarios</title>
</head>
<body>
<!-- Formulario del registro -->
Los campos marcados con (*) son obligatorios
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">(*) Nombre:</td>
<td><input type="text" name="Nombre" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">(*) Apellidos:</td>
<td><input type="text" name="Apellidos" value="" size="50"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">(*) Mail:</td>
<td><input type="text" name="Mail" value="" size="50"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Edad:</td>
<td><input type="text" name="Edad" value="" size="10"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Empresa:</td>
<td><input type="text" name="Empresa" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Dirección:</td>
<td><input type="text" name="Dir" value="" size="50"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Ciudad:</td>
<td><input type="text" name="Ciudad" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Teléfono:</td>
<td><input type="text" name="Telefono" value="" size="16"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Deporte:</td>
<td>
<input type="checkbox" name="Deporte[]" value="Rugby" >
Rugby<br />
<input name="Deporte[]" type="checkbox" value="Vela" />
Vela<br />
<label>
<input name="Deporte[]" type="checkbox" value="Ecuestre" />
Ecuestre<br />
<input name="Deporte[]" type="checkbox" value="Tenis" />
Tenis<br />
<input name="Deporte[]" type="checkbox" value="Golf" />
Golf
</label></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">(*) Password:</td>
<td><input type="password" name="Password" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Registrarme"></td>
</tr>
</table>
<input type="hidden" name="id_user" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<!--Termina formulario del registro -->
</body>
</html>
![borracho](http://static.forosdelweb.com/fdwtheme/images/smilies/borracho.png)
Les agradezco de antemano, un saludo cordial..
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
Ricardo.