web_master Posted September 16, 2011 Share Posted September 16, 2011 Hi, I still have a problem. How can I check availabiliti from database with JavaScript: Jscript: var xmlhttp function showHint(sifrad) { if (sifrad.length==0) { document.getElementById("message_sifrad").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="js/check_artikli_sifrad.php"; url=url+"?w="+sifrad; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=showMessage; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function showMessage() { if (xmlhttp.readyState==4) { document.getElementById("message_sifrad").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } php file: <?php //get the q parameter from URL $q = $_GET['w']; //lookup all hints from array if length of w>0 if (strlen($w) >= 3) { $getid1 = mysql_query("SELECT * FROM `p_artikli` WHERE `p_artikli_sifrad` = '$w'"); $getid_row1 = mysql_num_rows($getid1); if($getid_row1 > 0) { $response1 = '<img src="media/aviable_NOT_icon1.gif" alt="not aviable">'; } else { $response1 = '<img src="media/aviable_icon1.gif" alt="aviable">'; } } //output the response echo $response1; ?> html script (form for check): <div class="cont_form_right"><input type="text" name="p_artikli_sifrad" value="<?php echo $REQUEST['p_artikli_sifrad'];?>" onkeyup="showHint(this.value)" class="form_name" /><div id="message_sifrad" class="cont_form_aviable_not"></div> ------------------------ But I want to check the another data check from database, mean another column... T Quote Link to comment https://forums.phpfreaks.com/topic/247282-multiple-check-availability-from-database/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.