feanorian82 Δημοσιεύτηκε Αύγουστος 29, 2007 #1 Κοινοποίηση Δημοσιεύτηκε Αύγουστος 29, 2007 Σας έχω ζαλίσει ε; Έχω το εξης: html file <!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=iso-8859-7" /> <title>a j a x</title> </head> <body> <script src="ajax.js"></script> <form > <label>My Value 1: <input type="text" id="pn" name="pn" onsubmit="keyup()"></label><br /> </form> <span id="description"></span> </body> </html> κώδικας: // JavaScript Document <script type="text/javascript"> <!-- var http = createRequestObject(); function createRequestObject() { var xmlhttp; try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");} catch(f) { xmlhttp=null; } } if(!xmlhttp&&typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } return xmlhttp; } //---------------------------------------------------------------------------------------- function sendRequestTextPost() { //var rnd = Math.random();+'&rnd='+rnd var pn = escape(document.getElementById("pn").value); //var myvalue2 = escape(document.getElementById("myvalue2").value); try{ http.open('POST', 'finddrug.php'); http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http.onreadystatechange = handleResponseText; http.send('pn='+pn); } catch(e){} finally{} } //--------------------------------------------------------------------------------------- function handleResponseText() { try{ if((http.readyState == 4)&& (http.status == 200)){ var response = http.responseText.split("|"); document.getElementById("singlep").innerHTML = response[0]; document.getElementById("description").innerHTML = response[1]; } } catch(e){alert("hello");} finally{} } //---------------------------------------------------------------------------------------- function keyUp() { window.setTimeout("sendRequest()", 400); } // --> </script> κώδικας: php file <?php //Database Connection include("db/db_connection.php"); $pn=$_POST['pn']; $splt=str_split($pn, 3); //breaking into blocks of 4 digits plus one more************************ //$splt[0] --- $splt[4] //The header of the first 3 and the tail of the last digit are not needed******* $pn=$splt[1].$splt[2].$splt[3]; //Assembling the P/N to look up for at the Database**************** //Executing query to database ".$_POST[catalog]." $query=mysql_query("SELECT * FROM catalog200702 WHERE pn='".$pn."'"); $rows=mysql_num_rows($query); $results=mysql_fetch_array($query); if($rows != 0){ $description=$results[description];// $singlep=$results[singlep]; $bulkp=$results[bulkp]; } else{ $error0="***Δεν έχει εισαχθεί έγκυρος κωδικός .";} echo $response=$singlep."|".$description."|".$bulkp."|".$error0; ?> Το URL μου έχει τη μορφή page.html?pn=xxxxxxxx με χχχχχχχχ οτι του δωσω... Ωστόσο από κάτω το α΄πόλυτο κενό. Δεν κουνιέται φύλλο στο φυλλομετρητή. Ενα μικρό debugging καποιος γτ κο-κο-κόλλησα... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.