Ver Mensaje Individual
  #6 (permalink)  
Antiguo 24/05/2016, 11:55
thelighter
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: script automatico editar

este es el formulario de edicion

Código PHP:
Ver original
  1. <?php require_once('../../Connections/agregarequipos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $editFormAction = $_SERVER['PHP_SELF'];
  35. if (isset($_SERVER['QUERY_STRING'])) {
  36.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  37. }
  38.  
  39. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) {
  40.   $updateSQL = sprintf("UPDATE clientes SET nombres=%s, ip=%s, mac=%s, cell=%s, direcion=%s, comentario=%s, categoria=%s, pago_total=%s, fecha_inicial=%s, fecha_final=%s, codigo=%s, dias_p=%s,disable=%s, apellido=%s WHERE id=%s",
  41.                        GetSQLValueString($_POST['nombres'], "text"),
  42.                        GetSQLValueString($_POST['ip'], "text"),
  43.                        GetSQLValueString($_POST['mac'], "text"),
  44.                        GetSQLValueString($_POST['cell'], "text"),
  45.                        GetSQLValueString($_POST['direcion'], "text"),
  46.                        GetSQLValueString($_POST['comentario'], "text"),
  47.                        GetSQLValueString($_POST['categoria'], "text"),
  48.                        GetSQLValueString($_POST['pago_total'], "text"),
  49.                        GetSQLValueString($_POST['fecha_inicial'], "text"),
  50.                        GetSQLValueString($_POST['fecha_final'], "text"),
  51.                        GetSQLValueString($_POST['codigo'], "text"),
  52.                        GetSQLValueString($_POST['dias_p'], "text"),
  53.                        GetSQLValueString($_POST['disable'], "text"),
  54.                        GetSQLValueString($_POST['apellido'], "text"),
  55.                        GetSQLValueString($_POST['id'], "int"));
  56.  
  57.   mysql_select_db($database_agregarequipos, $agregarequipos);
  58.   $Result1 = mysql_query($updateSQL, $agregarequipos) or die(mysql_error());
  59. }
  60.  
  61. $colname_Recordset1 = "-1";
  62. if (isset($_GET['id'])) {
  63.   $colname_Recordset1 = $_GET['id'];
  64. }
  65. mysql_select_db($database_agregarequipos, $agregarequipos);
  66. $query_Recordset1 = sprintf("SELECT * FROM clientes WHERE id = %s", GetSQLValueString($colname_Recordset1, "text"));
  67. $Recordset1 = mysql_query($query_Recordset1, $agregarequipos) or die(mysql_error());
  68. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  69. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  70.  
  71. mysql_free_result($Recordset1);
  72. ?>
  73.  
  74.  
  75. <form  action="../app/Arp_Dhcp/Editar/editar_arp_dhcp.php" method="post" name="form" id="form">
  76.  
  77.  
  78.    
  79.      <div class="row-fluid">
  80.     <div class="span2 lightblue">
  81.               <label>Nombre.</label>
  82.               <input name="nombres" required type="text" class="span12" id="nombres" placeholder="Nombre del Titular" value="<?php echo htmlentities($row_Recordset1['nombres'], ENT_COMPAT, ''); ?>">          
  83.             </div>
  84.            
  85.            
  86.             <div class="span5 lightblue">
  87.               <label>Apellidos.</label>
  88.               <input name="apellido" type="text" class="span12" id="cell" required placeholder="Apellidos del Cliente" value="<?php echo htmlentities($row_Recordset1['apellido'], ENT_COMPAT, ''); ?>">    
  89.             </div>
  90.            
  91.            
  92.            
  93.             <div class="span5 lightblue">
  94.               <label>Cell.</label>
  95.               <input name="cell" type="text" class="span12" id="cell" required placeholder="# Celular del Cliente" value="<?php echo htmlentities($row_Recordset1['cell'], ENT_COMPAT, ''); ?>">    
  96.             </div>
  97.             <div class="row-fluid">
  98.     <div class="span4 lightblue">
  99.               <label>IP</label>
  100.               <input name="ip" required type="text" class="span12" id="ip" placeholder="Ip del Equipo" value="<?php echo htmlentities($row_Recordset1['ip'], ENT_COMPAT, ''); ?>">    
  101.             </div>