Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/09/2006, 12:12
AME
 
Fecha de Ingreso: julio-2006
Mensajes: 71
Antigüedad: 17 años, 8 meses
Puntos: 0
Sonrisa como actualizar un registro nuevo de un formulario

HOLA QUE TAL A TODOS??

Tengo un detalle.

lo que pasa es que tengo mi index en donde cuenta con 3 frame:
arriba, menu y contendio, entonces cuando a mi menu le doy click en uno de las opciones, si las abre donde necesito pero cuando a esa opcion selceciona lle doy agregar abre una ventanita donde lo agrego, el problema es que despues de agregar no se actualiza o no muestra lo agregado en mi formulario. si le doy F5 me saca del formulario y me regresa al index.
entonces me gustaria saber como corregir ese detalle.

mi formulario es:
<?php require_once('Connections/conexion.php'); ?>
<?php
mysql_select_db($database_conexion, $conexion);
$query_Recordset1 = "SELECT * FROM cathardware";
$Recordset1 = mysql_query($query_Recordset1, $conexion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
var x;
function abre()
{
x=window.open ("agregarhardware.php", "ventana","toolbar=no location=no status=no fullscreen=no width=400 height=200 top=200 left=200");
}

function eliminar()
{
x=window.open ("eliminarhardware.php", "ventana","toolbar=no location=no status=no fullscreen=no width=400 height=130 top=200 left=200");
}
</script>
</head>

<body background="imagenes/untitled.bmp">
<table width="680" height="63" align="center" background="imagenes/PLANTILLA2.JPG">
<tr>

<td width="672" height="57">
<div align="center" class="texto">
<h1><font color="#006600" size="24" face="Bookman Old Style"><font size="5">"CLASIFICACION
DE HARDWARE&quot;</font></font></h1>
</div></td>
</tr>
</table><br>
<table width="373" height="297" border="5" align="center" background="imagenes/PLANTILLA2.JPG"cellspacing="1" bordercolor="#CC9966">
<tr>
<td width="357" height="285"><br />
<table width="44%" border="0" align="center"
bordercolor="#A9885C">
<tr>
<td height="5"><br> <table width="43%" border="1" align="center" bordercolor="#D3C6AB">
<tr>
<td width="12%">IDHardware</td>
<td width="88%">Descripci&oacute;n</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['ID_Hardware']; ?></td>
<td><?php echo $row_Recordset1['Descripcion']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<br>
<div align="center">
<input name="agregar" type="submit" value="Agregar" onClick="abre()">&nbsp;
<input name="eliminar" type="submit" value="Eliminar" onClick="eliminar()">
</div>

</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

mi funcion abre es esta:

<?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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO cathardware (Descripcion) VALUES (%s)",
GetSQLValueString($HTTP_POST_VARS['Descripcion'], "text"));

mysql_select_db($database_conexion, $conexion);
$Result1 = mysql_query($insertSQL, $conexion) or die(mysql_error());

$insertGoTo = "agregarhardware.PHP";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_conexion, $conexion);
$query_Recordset1 = "SELECT * FROM cathardware";
$Recordset1 = mysql_query($query_Recordset1, $conexion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!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>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" language="JavaScript">
var x;
function cierra()
{
window.close();
}
</script>
<style type="text/css">
<!--
.Estilo1 {color: #D6C0A0}
-->
</style>
</head>

<body background="imagenes/untitled.bmp">
<table border="5" align="center" cellspacing="1" bordercolor="#CC9966">
<tr>
<td>
<form method="POST" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center" >
<tr valign="baseline">
<td width="88" height="25" align="right" nowrap><span class="Estilo1">Descripcion</span>:</td>
<td width="194"><input name="Descripcion" type="text" value="" size="32" maxlength="30"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" onClick="MM_validateForm('ID_Hardware','','RinRang e100:300');return document.MM_returnValue" value="Aceptar">
&nbsp; <input name="cerrar" type="reset" value="Cerrar" onClick="cierra()"/></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

espero haberme dado a entender.
graciassssss por todo