Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Recibir por POst Ayuda

Estas en el tema de Recibir por POst Ayuda en el foro de Frameworks JS en Foros del Web. Hola aqui tengo lo que pongo para pedir los datos: form_registro.php Código PHP: <!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" lang="en_US" xml:lang="en_US"> <!--  * Created on Jul 30, 2006  *  * To change the template for this generated file go to  * Window - Preferences - PHPeclipse - PHP - Code Templates -->  <head>   <title>Registro - Verynice </title>  </head> ...
  #1 (permalink)  
Antiguo 31/07/2006, 17:55
 
Fecha de Ingreso: septiembre-2003
Mensajes: 384
Antigüedad: 20 años, 7 meses
Puntos: 0
Recibir por POst Ayuda

Hola aqui tengo lo que pongo para pedir los datos:

form_registro.php
Código PHP:
<!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" lang="en_US" xml:lang="en_US">
<!--
 * Created on Jul 30, 2006
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
-->
 <head>
  <title>Registro - Verynice </title>
 </head>
 <body>

<form action="javascript:get(document.getElementById('myform'));" name="myform" id="myform">
<table align="center"">
<tr>


<input type="hidden" id="mytextarea1" value"sdfsdfg"></textarea>

<td><p>Usuario:</td>
<td><input type="text" size="14" name="usuario" id="usuario"></input></td>
</tr>
<tr>
<td><p>Contraseña:</td>
<td><input type="text" size="14" name="password" id="password"></input></td>


<tr>
<td><p>Repetir Contraseña:</input></td>
<td><input type="text" size="14" name="password2"></input></td>
</tr>
<tr>
<td><p>E-mail:</td>
<td><input type="text" size="25" name="mail1" id="mail1"></input></td>
</tr>
<tr>
<td><p>Repetir E-mail:</td>
<td><input type="text" size="25" name="mail2"></input></td>
</tr>
<tr>
<td><p>Nombres:</td>
<td><input type="text" size="40" name="nombres" id="nombres"></input></td>
</tr>
<tr>
<td><p>Apellidos:</td>
<td><input type="text" size="40" name="apellidos" id="apellidos"></input></td>
</tr>
<tr>
<tr>
<td>Fecha Nac.:</TD>
<td><SELECT NAME="mes" id="mes">
<OPTION></OPTION>
<OPTION VALUE="01">Enero</OPTION>
<OPTION VALUE="02">Febrero</OPTION>
<OPTION VALUE="03">Marzo</OPTION>
<OPTION VALUE="04">Abril</OPTION>
<OPTION VALUE="05">Mayo</OPTION>
<OPTION VALUE="06">Junio</OPTION>
<OPTION VALUE="07">Julio</OPTION>
<OPTION VALUE="08">Agosto</OPTION>
<OPTION VALUE="09">Septiembre</OPTION>
<OPTION VALUE="10">Octubre</OPTION>
<OPTION VALUE="11">Noviembre</OPTION>
<OPTION VALUE="12">Diciembre</OPTION>
</SELECT>

<SELECT NAME="dia" id="dia">
<OPTION></OPTION>
<OPTION VALUE="01">01</OPTION>
<OPTION VALUE="02">02</OPTION>
<OPTION VALUE="03">03</OPTION>
<OPTION VALUE="04">04</OPTION>
<OPTION VALUE="05">05</OPTION>
<OPTION VALUE="06">06</OPTION>
<OPTION VALUE="07">07</OPTION>
<OPTION VALUE="08">08</OPTION>
<OPTION VALUE="09">09</OPTION>
<OPTION VALUE="10">10</OPTION>
<OPTION VALUE="11">11</OPTION>
<OPTION VALUE="12">12</OPTION>
<OPTION VALUE="13">13</OPTION>
<OPTION VALUE="14">14</OPTION>
<OPTION VALUE="15">15</OPTION>
<OPTION VALUE="16">16</OPTION>
<OPTION VALUE="17">17</OPTION>
<OPTION VALUE="18">18</OPTION>
<OPTION VALUE="19">19</OPTION>
<OPTION VALUE="20">20</OPTION>
<OPTION VALUE="21">21</OPTION>
<OPTION VALUE="22">22</OPTION>
<OPTION VALUE="23">23</OPTION>
<OPTION VALUE="24">24</OPTION>
<OPTION VALUE="25">25</OPTION>
<OPTION VALUE="26">26</OPTION>
<OPTION VALUE="27">27</OPTION>
<OPTION VALUE="28">28</OPTION>
<OPTION VALUE="29">29</OPTION>
<OPTION VALUE="30">30</OPTION>
<OPTION VALUE="31">31</OPTION>
</SELECT>

<SELECT NAME="ano" id="ano">
<OPTION></OPTION>
<?php
for($i=1920$i<=2001$i++)
echo
"<OPTION VALUE=\"$i\">$i</OPTION>\n";
?>
</SELECT>
</td>
</tr>
<td><p>Ciudad:</td>
<td><textarea name="direccion" cols=30 rows=4 id="direccion"> </textarea></td>
</tr>
<tr>
<td><p>Sector:</td>
<td><input type="text" size="40" name="sector" id="sector"></input></td>
</tr>

<tr>
<td><p>Calle:</td>
<td><textarea name="calle" cols=30 rows=4 id="calle"></textarea></td>
</tr>
<tr>
<td></td>
<td align="right">
<input type="button" name="button" value="Submit" onclick="javascript:get(this.parentNode);">
</p></td></tr>
</table>
</form>
<br><br>Server-Response:<br>
<hr>
<span name="myspan" id="myspan"></span>
<hr>
Mi ajax_engine.js
Código HTML:
   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('myspan').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function get(obj) {
      var poststr = "usuario=" + encodeURI( document.getElementById("usuario").value ) +
                    "&password=" + encodeURI( document.getElementById("password").value ) +
					"&nombres=" + encodeURI( document.getElementById("nombres").value ) +
      				"&apellidos=" + encodeURI( document.getElementById("apellidos").value ) +
      				"&dia=" + encodeURI( document.getElementById("dia").value ) +
      				"&mes=" + encodeURI( document.getElementById("mes").value ) +
      				"&ano=" + encodeURI( document.getElementById("ano").value ) +
      				"&direccion=" + encodeURI( document.getElementById("direccion").value ) +
      				"&sector=" + encodeURI( document.getElementById("sector").value ) +
      				"&calle=" + encodeURI( document.getElementById("calle").value );
     				

      makePOSTRequest('ua/registro.php', poststr);
   }
registro.php
Código PHP:
<?php
print_r
($_POST);
?>
El problema esta que solo me esta reciviendo 2 id, y no todos los del form, porque!!???
__________________
-----------------------------
Edgar Gonzalez
  #2 (permalink)  
Antiguo 31/07/2006, 18:03
 
Fecha de Ingreso: septiembre-2003
Mensajes: 384
Antigüedad: 20 años, 7 meses
Puntos: 0
bueno ya pude hacerlo, jejejejeje era un errosito en el primer input
__________________
-----------------------------
Edgar Gonzalez
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 19:51.