Re: pasar datos entre bd aqui va el codigo
<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">Apellido:</td>
<td><input type="text" name="apellido" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Rut:</td>
<td><input type="text" name="rut" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Direccion:</td>
<td><input type="text" name="direccion" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Field_11:</td>
<td><input type="text" name="field_11" value="<?php echo $row_Recordset2['id']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Nacimiento:</td>
<td><input type="text" name="nacimiento" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Mail:</td>
<td><input type="text" name="mail" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Npolera:</td>
<td><input type="text" name="npolera" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fono:</td>
<td><input type="text" name="fono" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
<input name="field_11" type="hidden" id="field_11" value="<?php echo $row_Recordset2['id']; ?>" />
</form>
<p> </p>
<?php require_once('../../../Connections/cpan2l.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 miembros (nombre, apellido, rut, direccion, field_11, nacimiento, e-mail, npolera, fono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['rut'], "text"),
GetSQLValueString($_POST['direccion'], "text"),
GetSQLValueString($_POST['field_11'], "text"),
GetSQLValueString($_POST['nacimiento'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['npolera'], "text"),
GetSQLValueString($_POST['fono'], "text"));
mysql_select_db($database_cpan2l, $cpan2l);
$Result1 = mysql_query($insertSQL, $cpan2l) or die(mysql_error());
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO miembros (nombre, apellido, rut, direccion, field_11, nacimiento, mail, npolera, fono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['rut'], "text"),
GetSQLValueString($_POST['direccion'], "text"),
GetSQLValueString($_POST['field_11'], "text"),
GetSQLValueString($_POST['nacimiento'], "text"),
GetSQLValueString($_POST['mail'], "text"),
GetSQLValueString($_POST['npolera'], "text"),
GetSQLValueString($_POST['fono'], "text"));
mysql_select_db($database_cpan2l, $cpan2l);
$Result1 = mysql_query($insertSQL, $cpan2l) or die(mysql_error());
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO miembros (nombre, apellido, rut, direccion, field_11, nacimiento, mail, npolera, fono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['rut'], "text"),
GetSQLValueString($_POST['direccion'], "text"),
GetSQLValueString($_POST['field_11'], "text"),
GetSQLValueString($_POST['nacimiento'], "text"),
GetSQLValueString($_POST['mail'], "text"),
GetSQLValueString($_POST['npolera'], "text"),
GetSQLValueString($_POST['fono'], "text"));
mysql_select_db($database_cpan2l, $cpan2l);
$Result1 = mysql_query($insertSQL, $cpan2l) or die(mysql_error());
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_GET['id'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_cpan2l, $cpan2l);
$query_Recordset1 = sprintf("SELECT nombre, apellido, rut, direccion, field_11, nacimiento, mail, npolera, fono FROM miembros WHERE id = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $cpan2l) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$colname_Recordset2 = "-1";
if (isset($_GET['id'])) {
$colname_Recordset2 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_cpan2l, $cpan2l);
$query_Recordset2 = sprintf("SELECT * FROM inscripciones1 WHERE id = %s", $colname_Recordset2);
$Recordset2 = mysql_query($query_Recordset2, $cpan2l) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
mysql_free_result($Recordset2);
?>
__________________ Juan Pablo Sánchez |