Mi problema es que no logro que la pagina editar_proyecto.php me tome los datos de la linea que quiero modificar...
Código PHP:
<?php require_once('Connections/localhost.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_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE proyectos SET noper=%s, admpro=%s, contacto=%s, region=%s, comuna=%s, direccion=%s, telefono=%s, correo=%s, pert=%s WHERE proy=%s",
GetSQLValueString($_POST['noper'], "text"),
GetSQLValueString($_POST['admpro'], "text"),
GetSQLValueString($_POST['contacto'], "text"),
GetSQLValueString($_POST['region'], "text"),
GetSQLValueString($_POST['comuna'], "text"),
GetSQLValueString($_POST['direccion'], "text"),
GetSQLValueString($_POST['telefono'], "text"),
GetSQLValueString($_POST['correo'], "text"),
GetSQLValueString($_POST['pert'], "text"),
GetSQLValueString($_POST['proy'], "text"));
mysql_select_db($database_localhost, $localhost);
$Result1 = mysql_query($updateSQL, $localhost) or die(mysql_error());
$updateGoTo = "modificacion_exitosa.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_localhost, $localhost);
$query_proyectos = "SELECT * FROM proyectos ORDER BY noper ASC";
$proyectos = mysql_query($query_proyectos, $localhost) or die(mysql_error());
$row_proyectos = mysql_fetch_assoc($proyectos);
$totalRows_proyectos = mysql_num_rows($proyectos);
?>
<!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>Documento sin título</title>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Proyecto:</td>
<td><?php echo $row_proyectos['proy']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">N.Ope,:</td>
<td><input type="text" name="noper" value="<?php echo htmlentities($row_proyectos['noper'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Administrador:</td>
<td><input type="text" name="admpro" value="<?php echo htmlentities($row_proyectos['admpro'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Contacto:</td>
<td><input type="text" name="contacto" value="<?php echo htmlentities($row_proyectos['contacto'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Región:</td>
<td><input type="text" name="region" value="<?php echo htmlentities($row_proyectos['region'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Comuna:</td>
<td><input type="text" name="comuna" value="<?php echo htmlentities($row_proyectos['comuna'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Dirección:</td>
<td><input type="text" name="direccion" value="<?php echo htmlentities($row_proyectos['direccion'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Telefono:</td>
<td><input type="text" name="telefono" value="<?php echo htmlentities($row_proyectos['telefono'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Correo:</td>
<td><input type="text" name="correo" value="<?php echo htmlentities($row_proyectos['correo'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Pertenece a:</td>
<td><input type="text" name="pert" value="<?php echo htmlentities($row_proyectos['pert'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Actualizar registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="proy" value="<?php echo $row_proyectos['proy']; ?>" />
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($proyectos);
?>
Con respcto al boton Eliminar, tampoco se como hacerlo... pero ya encontrare la forma, espero...