Foros del Web » Programando para Internet » PHP »

problema con echo

Estas en el tema de problema con echo en el foro de PHP en Foros del Web. hola a todos espero que estén bien tengo un problema que espero que me puedan ayudar tengo 3 paginas una es para poner un folio ...
  #1 (permalink)  
Antiguo 04/10/2010, 14:13
Avatar de mexbale  
Fecha de Ingreso: septiembre-2010
Ubicación: Iztapalapa
Mensajes: 146
Antigüedad: 13 años, 7 meses
Puntos: 1
problema con echo

hola a todos espero que estén bien tengo un problema que espero que me puedan ayudar
tengo 3 paginas una es para poner un folio y hacer una consulta a la base de datos la otra es para recibir los datos y la tercera es un echo
les explico mejor
lo que quiero es que cuando tecleen el folio les mande a otra pagina para ver la información de ese folio, en la otra pagina si ven un error que lo puedan modificar. la ultima pagina tengo que me muestre los datos que mandaron de la segunda pagina
es un echo sencillo y ahí tengo el problema
de la primara a la segunda pagina todo esta bien, pero la segunda muestra la información la modifican y después la mandan a la otra pagina y no les aparece nada no se donde esta mi error espero que me puedan ayudar con este problema
de antemano les doy las gracias
este es el codigo que uso para las tres paginas:
  #2 (permalink)  
Antiguo 04/10/2010, 14:14
Avatar de mexbale  
Fecha de Ingreso: septiembre-2010
Ubicación: Iztapalapa
Mensajes: 146
Antigüedad: 13 años, 7 meses
Puntos: 1
Respuesta: problema con echo

Código PHP:
Ver original
  1. <?php
  2. //initialize the session
  3. if (!isset($_SESSION)) {
  4. }
  5.  
  6. // ** Logout the current user. **
  7. $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
  8. if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  9.   $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
  10. }
  11.  
  12.  
  13. ?>
  14. <?php
  15. if (!function_exists("GetSQLValueString")) {
  16. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  17. {
  18.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  19.  
  20.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  21.  
  22.   switch ($theType) {
  23.     case "text":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;    
  26.     case "long":
  27.     case "int":
  28.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  29.       break;
  30.     case "double":
  31.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  32.       break;
  33.     case "date":
  34.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  35.       break;
  36.     case "defined":
  37.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  38.       break;
  39.   }
  40.   return $theValue;
  41. }
  42. }
  43.  
  44. $editFormAction = $_SERVER['PHP_SELF'];
  45. if (isset($_SERVER['QUERY_STRING'])) {
  46.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  47. }
  48.  
  49.  
  50. ?>
  51.  
  52. <?php require_once('localhost1.php'); ?>  
  53. <?php
  54. // *** Validate request to login to this site.
  55. if (!isset($_SESSION)) {
  56. }
  57.  
  58. $loginFormAction = $_SERVER['PHP_SELF'];
  59. if (isset($_GET['accesscheck'])) {
  60.   $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  61. }
  62.  
  63. if (isset($_POST['Nombre'])) {
  64.   $loginUsername=$_POST['Nombre'];
  65.   $MM_fldUserAuthorization = "";
  66.   $MM_redirectLoginSuccess = "tabular.php";
  67.   $MM_redirectLoginFailed = "index.php";
  68.   $MM_redirecttoReferrer = false;
  69.   mysql_select_db($database_localhost, $localhost);
  70.  
  71. //  $LoginRS__query=sprintf("SELECT usr, passwd FROM usuarios_sha1 WHERE usr=%s AND passwd=%s",
  72.   $LoginRS__query=sprintf("SELECT * FROM tabular WHERE folio='$loginUsername'",
  73.  
  74.     GetSQLValueString($loginUsername, "text"));
  75.    
  76.   $LoginRS = mysql_query($LoginRS__query, $localhost) or die(mysql_error());
  77.   $loginFoundUser = mysql_num_rows($LoginRS);
  78.   if ($loginFoundUser) {
  79.      $loginStrGroup = "";
  80.      
  81.     //declare two session variables and assign them
  82.     $_SESSION['MM_Username'] = $loginUsername;
  83.     //$_SESSION['MM_Id'] = $loginRS[2];
  84.  
  85.  
  86.     if (isset($_SESSION['PrevUrl']) && false) {
  87.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  88.     }
  89.    
  90.     echo "
  91.  
  92. <script language='Javascript'>
  93.  
  94.  
  95.    window.open(\"tabular.php\",\"tabular\",\"fullscreen,scrollbars\");
  96.  
  97.  
  98. </script>";
  99.  
  100.  
  101.  
  102.     //header("Location: " . $MM_redirectLoginSuccess );
  103.   }
  104.   else {
  105.     header("Location: ". $MM_redirectLoginFailed );
  106.   }
  107. }
  108. ?>
  109. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  110. <html xmlns="http://www.w3.org/1999/xhtml">
  111. <head>
  112. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  113. <title>Index</title>
  114. </head>
  115.  
  116. <body bgcolor="#FF9400">
  117. <form action="" method="POST">
  118. <center>
  119. <h1>Bienvenidos al proyecto de SEP Becas de Preparatoria</h1>
  120. <table width="550" border="1" bordercolor="#BF8330">
  121.   <tr>
  122.     <td colspan="2" bgcolor="#A66000"><div align="center">
  123.       <h2>Por favor escribe tu nombre y tu contraseña</h2>
  124.     </div></td>
  125.   </tr>
  126.   <tr>
  127.     <td>Teclea el folio</td>
  128.     <td><label>
  129.     <input name="Nombre" type="text" id="Nombre" size="9" maxlength="9" onkeyup = "this.value=this.value.toUpperCase();" />
  130.     </label></td>
  131.   </tr>
  132.   <tr>
  133.     <td colspan="2"><div align="center">
  134.       <input type="submit" name="Entrar" id="Entrar" value="Entrar a Capturar" />
  135.     </div></td>
  136.   </tr>
  137. </table>
  138. </center>
  139. </form>
  140. </body>
  141. </html>
  #3 (permalink)  
Antiguo 04/10/2010, 14:16
Avatar de mexbale  
Fecha de Ingreso: septiembre-2010
Ubicación: Iztapalapa
Mensajes: 146
Antigüedad: 13 años, 7 meses
Puntos: 1
Respuesta: problema con echo

Código PHP:
Ver original
  1. <?php
  2. //initialize the session
  3. if (!isset($_SESSION)) {
  4. }
  5. ?>
  6. <?php
  7. require_once('localhost1.php');
  8. if($localhost)
  9. {
  10. if(mysql_select_db($database_localhost ,$localhost));
  11. {
  12. $conectado=true;
  13. }
  14. }
  15. $sql="select * from TABULAR where folio='".$_SESSION['MM_Username']."'";
  16. $result=mysql_query($sql,$localhost) or die(" horrorex en SQLL ") ;
  17. $cantidadderen=mysql_num_rows($result);
  18. $row = mysql_fetch_array($result, MYSQL_NUM);
  19. ?>
  20. <?php
  21. if($localhost)
  22. {
  23. if(mysql_select_db($database_localhost ,$localhost));
  24. {
  25. $conectado=true;
  26. }
  27. }
  28. $nombres= explode (" ", $_SESSION['MM_Username']);
  29. $sql="select * from tabular where folio='".$_SESSION['MM_Username']."'";
  30. $result=mysql_query($sql,$localhost) or die(" horrorex en SQLL ") ;
  31. $cantidadderen=mysql_num_rows($result);
  32. $row1 = mysql_fetch_array($result, MYSQL_NUM);
  33. $_SESSION['folio']=$row1[0];
  34. $_SESSION['cve_ent']=$row1[1];
  35. $_SESSION['cve_mun']=$row1[2];
  36. $_SESSION['cve_loc']=$row1[3];
  37. $_SESSION['cve_ageb']=$row1[4];
  38. $_SESSION['mza']=$row1[5];
  39. $_SESSION['num_cap']=$row1[6];
  40. $_SESSION['nombre']=$row1[7];
  41. ?>
  42. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  43. <html xmlns="http://www.w3.org/1999/xhtml">
  44. <head>
  45. <script type="text/javascript">
  46. function tabular(evt, obj, tam) {
  47. tecla=(document.all) ? evt.keyCode : evt.which;
  48. if(tecla==8) return; // para la tecla de retroceso
  49. var frm=obj.form;
  50. var largo = obj.value.length;
  51. if (largo == tam) {
  52. for(i=0;i<frm.elements.length;i++)
  53. if(frm.elements[i]==obj) {
  54. if (i==frm.elements.length-1) i=-1;
  55. break }
  56. frm.elements[i+1].focus();
  57. return false;
  58. }
  59. }
  60. </script>
  61. <script language="JavaScript" type="text/javascript">
  62. function activaEstado(iden) //funcion para activar los campos
  63. {
  64. var elhtml2 = document.getElementById(iden);
  65. var elhtml = iden;
  66. if(elhtml2.style.display == 'none'){
  67. elhtml2.style.display = 'block';}
  68. else {elhtml2.style.display = 'block';}
  69. }
  70. </script>
  71. <script language="JavaScript" type="text/javascript">
  72. function desactivaEstado(iden) //funcion para desactivar los campos
  73. {
  74. var elhtml2 = document.getElementById(iden);
  75. var elhtml = iden;
  76.  
  77. elhtml2.style.display = 'none';
  78. elhtml2.value="";
  79. }
  80. </script>
  81. <script type="text/javascript">
  82.  
  83. //funcion para consultar el folio
  84.  
  85. function creaAjax(){
  86. var objetoAjax=false;
  87. try {
  88. /*Para navegadores distintos a internet explorer*/
  89. objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
  90. } catch (e) {
  91. try {
  92. /*Para explorer*/
  93. objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
  94. }
  95. catch (E) {
  96. objetoAjax = false;
  97. }
  98. }
  99.  
  100. if (!objetoAjax && typeof XMLHttpRequest!='undefined') {
  101. objetoAjax = new XMLHttpRequest();
  102. }
  103. return objetoAjax;
  104. }
  105.  
  106.  
  107.  
  108. function FAjax (valores)
  109. {
  110. var ajax=creaAjax();
  111. var capaContenedora = document.getElementById('elDiv');
  112.  
  113. /*Creamos y ejecutamos la instancia si el metodo elegido es POST*/
  114. ajax.open ('POST','consulta.php', true);
  115. ajax.onreadystatechange = function() {
  116. if (ajax.readyState==1) {
  117. capaContenedora.innerHTML="Cargando.......";
  118. }
  119. else if (ajax.readyState==4){
  120. if(ajax.status==200)
  121. {
  122. capaContenedora.innerHTML=ajax.responseText;
  123. }
  124. else if(ajax.status==404)
  125. {
  126.  
  127. capaContenedora.innerHTML = "La direccion no existe";
  128. }
  129. else
  130. {
  131. capaContenedora.innerHTML = "Error: ".ajax.status;
  132. }
  133. }
  134. }
  135. ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  136. ajax.send('FOLIO_01='+valores);
  137. return;
  138.  
  139. }
  140. </script>
  141. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  142. <title>Documento sin t&iacute;tulo</title>
  143. <style type="text/css">
  144. style1 {
  145.     color: #0000FF;
  146.     font-weight: bold;
  147. }
  148. style2 {color: #0000FF}
  149. -->
  150. </style>
  151. <style type="text/css">
  152. <!--
  153. .Estilo1 {color: #999999}
  154. -->
  155. </style>
  156. </head>
  157.  
  158. <body bgcolor="#CCFF00">
  159. <form name="formulario" id="formulario" action="ECHO.PHP" method="post" >
  160. <h1><center>
  161.   <strong>Esto es una prueba para insertar el nombre y clave de capturista y recaptura</strong>
  162. </center>
  163. </h1>
  164. <table width="950" align="center">
  165.   <tr>
  166.     <td style="border-bottom:1px dashed #A60C00"><strong>2. FOLIOS</strong></td>
  167.   </tr>
  168.   <tr>
  169.     <td style="border-bottom:1px dashed #A60C00"><div align="right">FOLIO DE LA VIVIENDA</div></td>
  170.   </tr>
  171.   <tr>
  172.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  173.       <input name="FOLIO" type="text" id="FOLIO" maxlength="9" value="<? echo $_SESSION['folio'];?>" /><input name="FOLIO" type="hidden" id="FOLIO" maxlength="9" />
  174.     </div></td>
  175.   </tr>
  176.   <tr>
  177.     <td style="border-bottom:1px dashed #A60C00"><div align="right" id="elDiv">?????</div></td>
  178.   </tr>
  179. </table>
  180. <table width="950" align="center">
  181.   <tr>
  182.     <td colspan="3" style="border-bottom:1px dashed #A60C00"><strong>1. IDENTIFICACION GEOGRAFICA</strong></td>
  183.   </tr>
  184.   <tr>
  185.     <td style="border-bottom:1px dashed #A60C00"><div align="right">ENTIDAD FEDERATIVA</div></td>
  186.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  187.       <input name="CVE_ENT" type="text" id="CVE_ENT" size="2" maxlength="2" value="<? echo $_SESSION['cve_ent'];?>" />
  188.     </div></td>
  189.     <td style="border-bottom:1px dashed #A60C00"><input name="CVE_ENT" type="hidden" id="CVE_ENT" size="2" maxlength="2" /></td>
  190.   </tr>
  191.   <tr>
  192.     <td style="border-bottom:1px dashed #A60C00"><div align="right">MUNICIPIO O DELEGACION</div></td>
  193.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  194.       <input name="CVE_MUN" type="text" id="CVE_MUN" size="3" maxlength="3" value="<? echo $_SESSION['cve_mun'];?>" />
  195.     </div></td>
  196.     <td style="border-bottom:1px dashed #A60C00"><input name="CVE_MUN" type="hidden" id="CVE_MUN" size="3" maxlength="3" /></td>
  197.   </tr>
  198.   <tr>
  199.     <td style="border-bottom:1px dashed #A60C00"><div align="right">LOCALIDAD</div></td>
  200.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  201.       <input name="CVE_LOC" type="text" id="CVE_LOC" size="4" maxlength="4" value="<? echo $_SESSION['cve_loc'];?>" />
  202.     </div></td>
  203.     <td style="border-bottom:1px dashed #A60C00"><input name="CVE_LOC" type="hidden" id="CVE_LOC" size="4" maxlength="4" /></td>
  204.   </tr>
  205.   <tr>
  206.     <td style="border-bottom:1px dashed #A60C00"><div align="right">CLAVE DE AGEB</div></td>
  207.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  208.       <input name="CVE_AGEB" type="text" id="CVE_AGEB" size="4" maxlength="4" value="<? echo $_SESSION['cve_ageb'];?>" />
  209.     </div></td>
  210.     <td style="border-bottom:1px dashed #A60C00"><input name="CVE_AGEB" type="hidden" id="CVE_AGEB" size="4" maxlength="4" /></td>
  211.   </tr>
  212.   <tr>
  213.     <td style="border-bottom:1px dashed #A60C00"><div align="right">MANZANA</div></td>
  214.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  215.       <input name="MZA" type="text" id="MZA" size="3" maxlength="3" value="<? echo $_SESSION['mza'];?>" />
  216.     </div></td>
  217.     <td style="border-bottom:1px dashed #A60C00"><input name="MZA" type="hidden" id="MZA" size="3" maxlength="3" /></td>
  218.   </tr>
  219.   <tr bgcolor="#0000FF">
  220.     <td style="border-bottom:1px dashed #A60C00"><div align="right" class="Estilo1">CLAVE DE CAPTURISTA</div></td>
  221.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  222.       <input name="num_cap" type="text" id="num_cap" size="2" maxlength="2" readonly="true" style="background:none" value="<? echo $_SESSION['num_cap'];?>" />
  223.     </div></td>
  224.     <td style="border-bottom:1px dashed #A60C00">&nbsp;</td>
  225.   </tr>
  226.   <tr bgcolor="#0000FF">
  227.     <td style="border-bottom:1px dashed #A60C00"><div align="right" class="Estilo1">NOMBRE DE CAPTURISTA</div></td>
  228.     <td style="border-bottom:1px dashed #A60C00"><div align="right">
  229.       <input name="nombre" type="text" id="nombre" size="30" maxlength="50" readonly="true" style="background:none" value="<? echo $_SESSION['nombre'];?>" />
  230.     </div></td>
  231.     <td style="border-bottom:1px dashed #A60C00">&nbsp;</td>
  232.   </tr>
  233.   <tr>
  234.     <td colspan="3" style="border-bottom:1px dashed #A60C00"><div align="center">
  235.       <input type="submit" name="Guardar" value="Guardar" />
  236.     </div></td>
  237.     </tr>
  238. </table>
  239. </form>
  240. </body>
  241. </html>

y la ultima es un echo sencillo


Código PHP:
Ver original
  1. <?PHP
  2. $FOLIO = $_POST['FOLIO'] = trim($_POST['FOLIO']);
  3. $CVE_ENT = $_POST['CVE_ENT'] = trim($_POST['CVE_ENT']);
  4. $CVE_MUN = $_POST['CVE_MUN'] = trim($_POST['CVE_MUN']);
  5. $CVE_LOC = $_POST['CVE_LOC'] = trim($_POST['CVE_LOC']);
  6. $CVE_AGEB = $_POST['CVE_AGEB'] = trim($_POST['CVE_AGEB']);
  7. $MZA = $_POST['MZA'] = trim($_POST['MZA']);
  8. $NUM_CAP = $_POST['NUM_CAP'] = trim($_POST['NUM_CAP']);
  9. $NOMBRE = $_POST['NOMBRE'] = trim($_POST['NOMBRE']);
  10.     echo '<b>DATOS ' .$FOLIO. ', ' .$CVE_ENT. ', ' .$CVE_MUN. ', ' .$CVE_LOC. ', ' .$CVE_AGEB. ', ' .$MZA. ', ' .$NUM_CAP. ', ' .$NOMBRE. '<br/>';
  11. ?>

Etiquetas: echo
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:18.