Retroceder   Foros del Web > Programación para sitios web > AJAX

Respuesta
 
Herramientas Desplegado
Antiguo 31-jul-2006, 17:55   #1 (permalink)
eagoweb2 está en el buen camino
 
Fecha de Ingreso: septiembre-2003
Mensajes: 369
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
eagoweb2 está desconectado   Responder Citando
Antiguo 31-jul-2006, 18:03   #2 (permalink)
eagoweb2 está en el buen camino
 
Fecha de Ingreso: septiembre-2003
Mensajes: 369
bueno ya pude hacerlo, jejejejeje era un errosito en el primer input
__________________
-----------------------------
Edgar Gonzalez
eagoweb2 está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 19:15.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93