Código PHP:
<?php require('Connections/mailinglist.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"] == "form2")) {
$insertSQL = sprintf("INSERT INTO registro (id, nombre, apellido, email, telefono, ciudad, fecha) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['telefono'], "int"),
GetSQLValueString($_POST['ciudad'], "text"),
GetSQLValueString($_POST['fecha'], "date"));
mysql_select_db($database_mailinglist, $mailinglist);
$Result1 = mysql_query($insertSQL, $mailinglist) or die(mysql_error());
$insertGoTo = "mailreg.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_mailinglist, $mailinglist);
$query_Recordset1 = "SELECT * FROM registro ORDER BY nombre ASC";
$Recordset1 = mysql_query($query_Recordset1, $mailinglist) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>..// B A S I N G E R //..</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(imagenes/fondofondo.jpg);
}
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #686E4C;
}
.style2 {color: #A6AC88}
.style4 {color: #444444}
.style9 {color: #424530; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style10 {color: #A6AC88; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style11 {color: #94906D; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; }
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="estilos.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<tr>
<td width="73%"> </td>
<td width="27%" rowspan="2" valign="top"> </td>
</tr>
<tr>
<td valign="top"><table width="389" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="403" height="85" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="">
</form>
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre:</td>
<td><input type="text" name="nombre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Apellido:</td>
<td><input type="text" name="apellido" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Telefono:</td>
<td><input type="text" name="telefono" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Ciudad:</td>
<td><input type="text" name="ciudad" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Fecha:</td>
<td><label>
<select name="fecha" id="fecha">
<option>2007</option>
<option>2006</option>
<option>2005</option>
<option>2004</option>
</select>
<select name="fecha" id="fecha2">
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
</select>
<select name="fecha" id="fecha3">
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
</select>
</label></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Insert record" /></td>
</tr>
</table>
<input type="hidden" name="id" value="" />
<input type="hidden" name="MM_insert" value="form2" />
</form>
<p> </p></td>
</tr>
</table></td>
</tr>
<tr>
<td width="403"><table width="398" border="0" cellspacing="0" cellpadding="0">
<tr>
</html>
<?php
mysql_free_result($Recordset1);
?>
asi va el codigo.. les deje lo basico .. pues el foro no me deja mas de 10000 caracteres