Cita:
Iniciado por satjaen
Muchas gracias, pero parece que no tiene respuesta del php. Es decir hacer el alert de introducir el teléfono si el campo está vacio y ya no hace nada mas.
Esto es lo que sale en Firebug:
GET [url]http://localhost:8888/sitiopruebas/valida1.phpTELEFONO=%5Bobject%20HTMLInputElement%5 D[/url] 200 OK 2ms
funcdin4.js (línea 27)
ParámetrosEncabezadosXMLCookies
Encabezados de respuesta
Cache-Control no-store, no-cache, must-revalidate
Connection Keep-Alive
Content-Length 0
Content-Type text/xml
Date Fri, 30 Nov 2012 00:55:39 GMT
Keep-Alive timeout=5, max=100
Server Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8r DAV/2 PHP/5.4.4
X-Powered-By PHP/5.4.4
Encabezados de solicitud
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Connection keep-alive
Cookie SQLiteManager_currentLangue=10
Host localhost:8888
Referer [url]http://localhost:8888/sitiopruebas/menu4.php[/url]
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/20100101 Firefox/16.0
perdona me faltaba la línea de echo $xml
Código PHP:
<?php
header('Content-Type: text/xml');
header("Cache-Control: no-store, no-cache, must-revalidate");
$xml="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
$xml.="<respuesta>\n";
require_once('Connections/conexion.php');
$TELEFONO = isset($_GET['TELEFONO']) ? $_GET['TELEFONO']:"";
$query=mysql_query("SELECT TELEFONO,NUM_USUARIO FROM usuarios WHERE TELEFONO ='".$TELEFONO."'");
$rows = mysql_num_rows($query);
if ($rows>0)
{
$assoc=mysql_fetch_assoc($query);
$xml.="<datos><![CDATA[1]]></datos>\n";
$xml.="<numusuario><![CDATA[".$assoc['NUM_USUARIO']."]]></numusuario>\n";
}
else
{
$xml.="<datos><![CDATA[0]]></datos>\n";
}
$xml.="</respuesta>\n";
echo $xml;
?>
y he cambiado if ($rows>=0) por if ($rows>0) que eso tb estaba mal