Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/03/2008, 15:41
Jhorb
 
Fecha de Ingreso: junio-2002
Mensajes: 261
Antigüedad: 22 años, 9 meses
Puntos: 0
Re: No guarda valores de los combo

Juaniquillo este es el código completo de la página, fue creada usando los Brindings de DW, así q el área repetitiva y el update de la misma es código nato de DW, x lo cual genera que no se almacene sino el último combo box.

Alguna cosa más me avisas....


Código PHP:
<?php require_once('Connections/Audito.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']);
}
/****************************************************************************************************/
/* INICIO DEL UPDATE */
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  
$updateSQL sprintf("UPDATE prueba SET valor=%s WHERE id=%s",
                       
GetSQLValueString($_POST['CmbVal'], "text"),
                       
GetSQLValueString($_POST['TxtID'], "int"));

  
mysql_select_db($database_Audito$Audito);
  
$Result1 mysql_query($updateSQL$Audito) or die(mysql_error());
}
/* FIN DEL UPDATE */
/****************************************************************************************************/
mysql_select_db($database_Audito$Audito);
$query_Recordset1 "SELECT * FROM prueba WHERE id<=5";
$Recordset1 mysql_query($query_Recordset1$Audito) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?><!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>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction?>">
  <?php do { ?>
    <table width="200" border="1">
      <tr>
        <td>ID</td>
        <td><label>
        <input name="TxtID" type="text" id="TxtID" size="4" maxlength="2" />
        </label></td>
        <td>VALOR</td>
        <td><label>
          <select name="CmbVal" id="CmbVal">
            <option>1</option>
            <option>2</option>
            <option>3</option>
            <option>4</option>
            <option>5</option>
            <option>6</option>
            <option>7</option>
            <option>8</option>
            <option>9</option>
            <option>10</option>
                    </select>
        </label></td>
      </tr>
          </table>
    <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?><p>&nbsp;  </p>
  <table width="200" border="1">
    <tr>
      <td width="128">&nbsp;</td>
      <td width="56"><label>
        <input type="submit" name="Submit" value="Submit" />
      </label></td>
    </tr>
  </table>
  <p>
    <label></label>
  </p>
  <input type="hidden" name="MM_update" value="form1">
</form>
</body>
</html>
<?php
mysql_free_result
($Recordset1);
?>
__________________
Buscando el camino...