Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/11/2011, 11:25
goyitoparana
 
Fecha de Ingreso: agosto-2009
Mensajes: 72
Antigüedad: 14 años, 9 meses
Puntos: 2
Como recupero los datos enviados del form por Dreamweaver

Hola como estan?
Les comento la situacion.
Utilice el asistente para fomularios de Dreamweaver e hice un formulario para insertar registros en una BD Mysql.
Al usar el asistente para insertar formularios el mismo me pide que le ponga a donde quiero dirigirme luego de insertar cada uno de los registros y yo le puse una pagina "x", pongamosle recibir.php.
Luego de terminar de diseñar el formulario y probarlo, yo cargo cada uno de los campos del registro y al poner "cargar" me lleva tal cual habia configurado yo en el asistente a la pagina recibir.php pero yo quiero alli recibir cada una de las variables enviadas, o sea, cada uno de los campos recibidos por post, pero no se ven cuando las llamo mediante echo $_POST['variable']
Cuando me fijo en el action del formulario Dreamweaver le ha puesto al mismo: <?php echo $editFormAction; ?>, cuando yo tengo entendido que cuando tu quieres enviar variables hacia otra pagina tienes que poner el nombre de la pagina a la que quieres direccionar en la variable action del form.
Le cambie <?php echo $editFormAction; ?> por recibir.php, y ahi sí que los recibo, pero no me los procesa a los datos, o sea no los carga a la BD dado que el proceso de carga lo hace en el mismo formulario en la pagina anterior.
Espero que me hayan entendido, les pego el codigo y espero que me puedan ayudar, gracias!

Código PHP:

<?php require_once('../../Connections/conexion.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_insert"])) && ($_POST["MM_insert"] == "form1")) {

  
$insertSQL sprintf("INSERT INTO inspecciones_detalles (insp_det_id_inspeccion, insp_det_periodo, insp_det_capital, insp_det_fecha_venc, insp_det_entrega, insp_det_fecha_entrega, insp_det_observaciones) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['insp_det_id_inspeccion'], "text"),
                       
GetSQLValueString($_POST['mes']."-".$_POST['anio'], "text"),                                   GetSQLValueString($_POST['insp_det_capital'], "double"),
                       
GetSQLValueString($_POST['insp_det_fecha_venc'], "text"),
                       
GetSQLValueString($_POST['insp_det_entrega'], "double"),
                       
GetSQLValueString($_POST['insp_det_fecha_entrega'], "text"),
                       
GetSQLValueString($_POST['insp_det_observaciones'], "text"));

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

  
$insertGoTo "intereses_result_detalles_funcion02.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_periodos2 "SELECT insp_num,insp_anio FROM inspecciones_lista";
$periodos2 mysql_query($query_periodos2$conexion) or die(mysql_error());
$row_periodos2 mysql_fetch_assoc($periodos2);
$totalRows_periodos2 mysql_num_rows($periodos2);
?>
<!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=utf-8" />
<title>Documento sin título</title>
</head>




<body>
<form action="intereses_result_detalles_funcion02.php" method="post" name="form1" id="form1">
  <table width="100%" align="center">
    <tr valign="baseline">
      <td align="left" valign="middle" nowrap="nowrap">Insp_det_id_inspeccion:</td>
      <td><label for="insp_det_id_inspeccion2"></label>
        <select name="insp_det_id_inspeccion" id="insp_det_id_inspeccion">
          <?php
do {  
?>
          <option value="<?php echo $row_periodos2['insp_num']."-".$row_periodos2['insp_anio']?>"<?php if (!(strcmp($row_periodos2['insp_num']."-".$row_periodos2['insp_anio'], $row_periodos2['insp_num']."-".$row_periodos2['insp_anio']))) {echo "selected=\"selected\"";} ?>><?php echo $row_periodos2['insp_num']."-".$row_periodos2['insp_anio']?></option>
          <?php
} while ($row_periodos2 mysql_fetch_assoc($periodos2));
  
$rows mysql_num_rows($periodos2);
  if(
$rows 0) {
      
mysql_data_seek($periodos20);
      
$row_periodos2 mysql_fetch_assoc($periodos2);
  }
?>
      </select></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="middle" nowrap="nowrap">Insp_det_periodo:</td>
      <td><label for="mes"></label>
        <select name="mes" id="mes">
          <option selected="selected">Enero</option>
          <option>Febrero</option>
          <option>Marzo</option>
          <option>Abril</option>
          <option>Mayo</option>
          <option>Junio</option>
          <option>Julio</option>
          <option>Agosto</option>
          <option>Setiembre</option>
          <option>Octubre</option>
          <option>Noviembre</option>
          <option>Diciembre</option>
      </select>
        <select name="anio" id="anio">
          <option selected="selected">2001</option>
          <option>2002</option>
          <option>2003</option>
          <option>2004</option>
          <option>2005</option>
          <option>2006</option>
          <option>2007</option>
          <option>2008</option>
          <option>2009</option>
          <option>2010</option>
          <option>2011</option>
          <option>2012</option>
          <option>2013</option>
      </select></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="middle" nowrap="nowrap">Insp_det_capital:</td>
      <td><input type="text" name="insp_det_capital" value="100" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="middle" nowrap="nowrap">Insp_det_fecha_venc:</td>
      <td><input type="text" name="insp_det_fecha_venc" value="2003-07-08" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="middle" nowrap="nowrap">Insp_det_entrega:</td>
      <td><input type="text" name="insp_det_entrega" value="100" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="middle" nowrap="nowrap">Insp_det_fecha_entrega:</td>
      <td><input type="text" name="insp_det_fecha_entrega" value="2006-07-26" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td align="left" valign="middle" nowrap="nowrap">Insp_det_observaciones:</td>
      <td><label for="insp_det_observaciones"></label>
      <textarea name="insp_det_observaciones" id="insp_det_observaciones" cols="45" rows="5"></textarea></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Insertar registro" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
  
</form>
<p align="center"><a href="index.php">Volver a principal</a></p>
</body>
</html>
<?php
mysql_free_result
($periodos2);
?>

PD: Yo necesito los valores que se ingresaron para procesarlos en una formula.

Última edición por goyitoparana; 11/11/2011 a las 11:40